{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [],
   "source": [
    "import pandas as pd\n",
    "import numpy as np\n",
    "import matplotlib.pyplot as plt"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# 缺失值处理"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [],
   "source": [
    "movie = pd.read_csv(\"./data/IMDB-Movie-Data.csv\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style>\n",
       "    .dataframe thead tr:only-child th {\n",
       "        text-align: right;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: left;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>Rank</th>\n",
       "      <th>Title</th>\n",
       "      <th>Genre</th>\n",
       "      <th>Description</th>\n",
       "      <th>Director</th>\n",
       "      <th>Actors</th>\n",
       "      <th>Year</th>\n",
       "      <th>Runtime (Minutes)</th>\n",
       "      <th>Rating</th>\n",
       "      <th>Votes</th>\n",
       "      <th>Revenue (Millions)</th>\n",
       "      <th>Metascore</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>1</td>\n",
       "      <td>Guardians of the Galaxy</td>\n",
       "      <td>Action,Adventure,Sci-Fi</td>\n",
       "      <td>A group of intergalactic criminals are forced ...</td>\n",
       "      <td>James Gunn</td>\n",
       "      <td>Chris Pratt, Vin Diesel, Bradley Cooper, Zoe S...</td>\n",
       "      <td>2014</td>\n",
       "      <td>121</td>\n",
       "      <td>8.1</td>\n",
       "      <td>757074</td>\n",
       "      <td>333.13</td>\n",
       "      <td>76.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>2</td>\n",
       "      <td>Prometheus</td>\n",
       "      <td>Adventure,Mystery,Sci-Fi</td>\n",
       "      <td>Following clues to the origin of mankind, a te...</td>\n",
       "      <td>Ridley Scott</td>\n",
       "      <td>Noomi Rapace, Logan Marshall-Green, Michael Fa...</td>\n",
       "      <td>2012</td>\n",
       "      <td>124</td>\n",
       "      <td>7.0</td>\n",
       "      <td>485820</td>\n",
       "      <td>126.46</td>\n",
       "      <td>65.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>3</td>\n",
       "      <td>Split</td>\n",
       "      <td>Horror,Thriller</td>\n",
       "      <td>Three girls are kidnapped by a man with a diag...</td>\n",
       "      <td>M. Night Shyamalan</td>\n",
       "      <td>James McAvoy, Anya Taylor-Joy, Haley Lu Richar...</td>\n",
       "      <td>2016</td>\n",
       "      <td>117</td>\n",
       "      <td>7.3</td>\n",
       "      <td>157606</td>\n",
       "      <td>138.12</td>\n",
       "      <td>62.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>4</td>\n",
       "      <td>Sing</td>\n",
       "      <td>Animation,Comedy,Family</td>\n",
       "      <td>In a city of humanoid animals, a hustling thea...</td>\n",
       "      <td>Christophe Lourdelet</td>\n",
       "      <td>Matthew McConaughey,Reese Witherspoon, Seth Ma...</td>\n",
       "      <td>2016</td>\n",
       "      <td>108</td>\n",
       "      <td>7.2</td>\n",
       "      <td>60545</td>\n",
       "      <td>270.32</td>\n",
       "      <td>59.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>5</td>\n",
       "      <td>Suicide Squad</td>\n",
       "      <td>Action,Adventure,Fantasy</td>\n",
       "      <td>A secret government agency recruits some of th...</td>\n",
       "      <td>David Ayer</td>\n",
       "      <td>Will Smith, Jared Leto, Margot Robbie, Viola D...</td>\n",
       "      <td>2016</td>\n",
       "      <td>123</td>\n",
       "      <td>6.2</td>\n",
       "      <td>393727</td>\n",
       "      <td>325.02</td>\n",
       "      <td>40.0</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "   Rank                    Title                     Genre  \\\n",
       "0     1  Guardians of the Galaxy   Action,Adventure,Sci-Fi   \n",
       "1     2               Prometheus  Adventure,Mystery,Sci-Fi   \n",
       "2     3                    Split           Horror,Thriller   \n",
       "3     4                     Sing   Animation,Comedy,Family   \n",
       "4     5            Suicide Squad  Action,Adventure,Fantasy   \n",
       "\n",
       "                                         Description              Director  \\\n",
       "0  A group of intergalactic criminals are forced ...            James Gunn   \n",
       "1  Following clues to the origin of mankind, a te...          Ridley Scott   \n",
       "2  Three girls are kidnapped by a man with a diag...    M. Night Shyamalan   \n",
       "3  In a city of humanoid animals, a hustling thea...  Christophe Lourdelet   \n",
       "4  A secret government agency recruits some of th...            David Ayer   \n",
       "\n",
       "                                              Actors  Year  Runtime (Minutes)  \\\n",
       "0  Chris Pratt, Vin Diesel, Bradley Cooper, Zoe S...  2014                121   \n",
       "1  Noomi Rapace, Logan Marshall-Green, Michael Fa...  2012                124   \n",
       "2  James McAvoy, Anya Taylor-Joy, Haley Lu Richar...  2016                117   \n",
       "3  Matthew McConaughey,Reese Witherspoon, Seth Ma...  2016                108   \n",
       "4  Will Smith, Jared Leto, Margot Robbie, Viola D...  2016                123   \n",
       "\n",
       "   Rating   Votes  Revenue (Millions)  Metascore  \n",
       "0     8.1  757074              333.13       76.0  \n",
       "1     7.0  485820              126.46       65.0  \n",
       "2     7.3  157606              138.12       62.0  \n",
       "3     7.2   60545              270.32       59.0  \n",
       "4     6.2  393727              325.02       40.0  "
      ]
     },
     "execution_count": 3,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "movie.head()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 缺失值是nan"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "False"
      ]
     },
     "execution_count": 4,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "np.all(pd.notnull(movie))  # 里面如果有一个缺失值,那么会返回False,说明有缺失值"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "True"
      ]
     },
     "execution_count": 5,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "np.any(pd.isnull(movie))  # 里面如果有一个缺失值,那么会返回True,说明有缺失值"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {},
   "outputs": [],
   "source": [
    "data = movie.dropna()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "True"
      ]
     },
     "execution_count": 7,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "np.all(pd.notnull(data))  # 里面如果有一个缺失值,那么会返回False,说明有缺失值"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "82.95637614678898"
      ]
     },
     "execution_count": 8,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "movie[\"Revenue (Millions)\"].mean()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "metadata": {},
   "outputs": [],
   "source": [
    "movie[\"Revenue (Millions)\"].fillna(movie[\"Revenue (Millions)\"].mean(), inplace=True)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style>\n",
       "    .dataframe thead tr:only-child th {\n",
       "        text-align: right;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: left;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>Rank</th>\n",
       "      <th>Title</th>\n",
       "      <th>Genre</th>\n",
       "      <th>Description</th>\n",
       "      <th>Director</th>\n",
       "      <th>Actors</th>\n",
       "      <th>Year</th>\n",
       "      <th>Runtime (Minutes)</th>\n",
       "      <th>Rating</th>\n",
       "      <th>Votes</th>\n",
       "      <th>Revenue (Millions)</th>\n",
       "      <th>Metascore</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>1</td>\n",
       "      <td>Guardians of the Galaxy</td>\n",
       "      <td>Action,Adventure,Sci-Fi</td>\n",
       "      <td>A group of intergalactic criminals are forced ...</td>\n",
       "      <td>James Gunn</td>\n",
       "      <td>Chris Pratt, Vin Diesel, Bradley Cooper, Zoe S...</td>\n",
       "      <td>2014</td>\n",
       "      <td>121</td>\n",
       "      <td>8.1</td>\n",
       "      <td>757074</td>\n",
       "      <td>333.13</td>\n",
       "      <td>76.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>2</td>\n",
       "      <td>Prometheus</td>\n",
       "      <td>Adventure,Mystery,Sci-Fi</td>\n",
       "      <td>Following clues to the origin of mankind, a te...</td>\n",
       "      <td>Ridley Scott</td>\n",
       "      <td>Noomi Rapace, Logan Marshall-Green, Michael Fa...</td>\n",
       "      <td>2012</td>\n",
       "      <td>124</td>\n",
       "      <td>7.0</td>\n",
       "      <td>485820</td>\n",
       "      <td>126.46</td>\n",
       "      <td>65.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>3</td>\n",
       "      <td>Split</td>\n",
       "      <td>Horror,Thriller</td>\n",
       "      <td>Three girls are kidnapped by a man with a diag...</td>\n",
       "      <td>M. Night Shyamalan</td>\n",
       "      <td>James McAvoy, Anya Taylor-Joy, Haley Lu Richar...</td>\n",
       "      <td>2016</td>\n",
       "      <td>117</td>\n",
       "      <td>7.3</td>\n",
       "      <td>157606</td>\n",
       "      <td>138.12</td>\n",
       "      <td>62.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>4</td>\n",
       "      <td>Sing</td>\n",
       "      <td>Animation,Comedy,Family</td>\n",
       "      <td>In a city of humanoid animals, a hustling thea...</td>\n",
       "      <td>Christophe Lourdelet</td>\n",
       "      <td>Matthew McConaughey,Reese Witherspoon, Seth Ma...</td>\n",
       "      <td>2016</td>\n",
       "      <td>108</td>\n",
       "      <td>7.2</td>\n",
       "      <td>60545</td>\n",
       "      <td>270.32</td>\n",
       "      <td>59.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>5</td>\n",
       "      <td>Suicide Squad</td>\n",
       "      <td>Action,Adventure,Fantasy</td>\n",
       "      <td>A secret government agency recruits some of th...</td>\n",
       "      <td>David Ayer</td>\n",
       "      <td>Will Smith, Jared Leto, Margot Robbie, Viola D...</td>\n",
       "      <td>2016</td>\n",
       "      <td>123</td>\n",
       "      <td>6.2</td>\n",
       "      <td>393727</td>\n",
       "      <td>325.02</td>\n",
       "      <td>40.0</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "   Rank                    Title                     Genre  \\\n",
       "0     1  Guardians of the Galaxy   Action,Adventure,Sci-Fi   \n",
       "1     2               Prometheus  Adventure,Mystery,Sci-Fi   \n",
       "2     3                    Split           Horror,Thriller   \n",
       "3     4                     Sing   Animation,Comedy,Family   \n",
       "4     5            Suicide Squad  Action,Adventure,Fantasy   \n",
       "\n",
       "                                         Description              Director  \\\n",
       "0  A group of intergalactic criminals are forced ...            James Gunn   \n",
       "1  Following clues to the origin of mankind, a te...          Ridley Scott   \n",
       "2  Three girls are kidnapped by a man with a diag...    M. Night Shyamalan   \n",
       "3  In a city of humanoid animals, a hustling thea...  Christophe Lourdelet   \n",
       "4  A secret government agency recruits some of th...            David Ayer   \n",
       "\n",
       "                                              Actors  Year  Runtime (Minutes)  \\\n",
       "0  Chris Pratt, Vin Diesel, Bradley Cooper, Zoe S...  2014                121   \n",
       "1  Noomi Rapace, Logan Marshall-Green, Michael Fa...  2012                124   \n",
       "2  James McAvoy, Anya Taylor-Joy, Haley Lu Richar...  2016                117   \n",
       "3  Matthew McConaughey,Reese Witherspoon, Seth Ma...  2016                108   \n",
       "4  Will Smith, Jared Leto, Margot Robbie, Viola D...  2016                123   \n",
       "\n",
       "   Rating   Votes  Revenue (Millions)  Metascore  \n",
       "0     8.1  757074              333.13       76.0  \n",
       "1     7.0  485820              126.46       65.0  \n",
       "2     7.3  157606              138.12       62.0  \n",
       "3     7.2   60545              270.32       59.0  \n",
       "4     6.2  393727              325.02       40.0  "
      ]
     },
     "execution_count": 10,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "movie.head()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Metascore\n"
     ]
    }
   ],
   "source": [
    "for i in movie.columns:\n",
    "    if np.any(pd.isnull(movie[i])) == True:\n",
    "        print(i)\n",
    "        movie[i].fillna(movie[i].mean(), inplace=True)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "False"
      ]
     },
     "execution_count": 12,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "np.any(pd.isnull(movie))  # 里面如果有一个缺失值,那么会返回True,说明有缺失值"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "metadata": {},
   "outputs": [],
   "source": [
    "wis = pd.read_csv(\"https://archive.ics.uci.edu/ml/machine-learning-databases/breast-cancer-wisconsin/breast-cancer-wisconsin.data\")\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 14,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style>\n",
       "    .dataframe thead tr:only-child th {\n",
       "        text-align: right;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: left;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>1000025</th>\n",
       "      <th>5</th>\n",
       "      <th>1</th>\n",
       "      <th>1.1</th>\n",
       "      <th>1.2</th>\n",
       "      <th>2</th>\n",
       "      <th>1.3</th>\n",
       "      <th>3</th>\n",
       "      <th>1.4</th>\n",
       "      <th>1.5</th>\n",
       "      <th>2.1</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>1002945</td>\n",
       "      <td>5</td>\n",
       "      <td>4</td>\n",
       "      <td>4</td>\n",
       "      <td>5</td>\n",
       "      <td>7</td>\n",
       "      <td>10</td>\n",
       "      <td>3</td>\n",
       "      <td>2</td>\n",
       "      <td>1</td>\n",
       "      <td>2</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>1015425</td>\n",
       "      <td>3</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>2</td>\n",
       "      <td>2</td>\n",
       "      <td>3</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>2</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>1016277</td>\n",
       "      <td>6</td>\n",
       "      <td>8</td>\n",
       "      <td>8</td>\n",
       "      <td>1</td>\n",
       "      <td>3</td>\n",
       "      <td>4</td>\n",
       "      <td>3</td>\n",
       "      <td>7</td>\n",
       "      <td>1</td>\n",
       "      <td>2</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>1017023</td>\n",
       "      <td>4</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>3</td>\n",
       "      <td>2</td>\n",
       "      <td>1</td>\n",
       "      <td>3</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>2</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>1017122</td>\n",
       "      <td>8</td>\n",
       "      <td>10</td>\n",
       "      <td>10</td>\n",
       "      <td>8</td>\n",
       "      <td>7</td>\n",
       "      <td>10</td>\n",
       "      <td>9</td>\n",
       "      <td>7</td>\n",
       "      <td>1</td>\n",
       "      <td>4</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "   1000025  5   1  1.1  1.2  2 1.3  3  1.4  1.5  2.1\n",
       "0  1002945  5   4    4    5  7  10  3    2    1    2\n",
       "1  1015425  3   1    1    1  2   2  3    1    1    2\n",
       "2  1016277  6   8    8    1  3   4  3    7    1    2\n",
       "3  1017023  4   1    1    3  2   1  3    1    1    2\n",
       "4  1017122  8  10   10    8  7  10  9    7    1    4"
      ]
     },
     "execution_count": 14,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "wis.head()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 缺失值是其他符号"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 15,
   "metadata": {},
   "outputs": [],
   "source": [
    "wis = wis.replace(to_replace=\"?\", value=np.nan)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 16,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style>\n",
       "    .dataframe thead tr:only-child th {\n",
       "        text-align: right;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: left;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>1000025</th>\n",
       "      <th>5</th>\n",
       "      <th>1</th>\n",
       "      <th>1.1</th>\n",
       "      <th>1.2</th>\n",
       "      <th>2</th>\n",
       "      <th>1.3</th>\n",
       "      <th>3</th>\n",
       "      <th>1.4</th>\n",
       "      <th>1.5</th>\n",
       "      <th>2.1</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>1002945</td>\n",
       "      <td>5</td>\n",
       "      <td>4</td>\n",
       "      <td>4</td>\n",
       "      <td>5</td>\n",
       "      <td>7</td>\n",
       "      <td>10</td>\n",
       "      <td>3</td>\n",
       "      <td>2</td>\n",
       "      <td>1</td>\n",
       "      <td>2</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>1015425</td>\n",
       "      <td>3</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>2</td>\n",
       "      <td>2</td>\n",
       "      <td>3</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>2</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>1016277</td>\n",
       "      <td>6</td>\n",
       "      <td>8</td>\n",
       "      <td>8</td>\n",
       "      <td>1</td>\n",
       "      <td>3</td>\n",
       "      <td>4</td>\n",
       "      <td>3</td>\n",
       "      <td>7</td>\n",
       "      <td>1</td>\n",
       "      <td>2</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>1017023</td>\n",
       "      <td>4</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>3</td>\n",
       "      <td>2</td>\n",
       "      <td>1</td>\n",
       "      <td>3</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>2</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>1017122</td>\n",
       "      <td>8</td>\n",
       "      <td>10</td>\n",
       "      <td>10</td>\n",
       "      <td>8</td>\n",
       "      <td>7</td>\n",
       "      <td>10</td>\n",
       "      <td>9</td>\n",
       "      <td>7</td>\n",
       "      <td>1</td>\n",
       "      <td>4</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "   1000025  5   1  1.1  1.2  2 1.3  3  1.4  1.5  2.1\n",
       "0  1002945  5   4    4    5  7  10  3    2    1    2\n",
       "1  1015425  3   1    1    1  2   2  3    1    1    2\n",
       "2  1016277  6   8    8    1  3   4  3    7    1    2\n",
       "3  1017023  4   1    1    3  2   1  3    1    1    2\n",
       "4  1017122  8  10   10    8  7  10  9    7    1    4"
      ]
     },
     "execution_count": 16,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "wis.head()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 17,
   "metadata": {},
   "outputs": [],
   "source": [
    "wis = wis.dropna()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 18,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "False"
      ]
     },
     "execution_count": 18,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "np.any(pd.isnull(wis))  # 里面如果有一个缺失值,那么会返回True,说明有缺失值"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# 数据离散化"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 19,
   "metadata": {},
   "outputs": [],
   "source": [
    "data = pd.read_csv(\"./data/stock_day.csv\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 20,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style>\n",
       "    .dataframe thead tr:only-child th {\n",
       "        text-align: right;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: left;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>open</th>\n",
       "      <th>high</th>\n",
       "      <th>close</th>\n",
       "      <th>low</th>\n",
       "      <th>volume</th>\n",
       "      <th>price_change</th>\n",
       "      <th>p_change</th>\n",
       "      <th>ma5</th>\n",
       "      <th>ma10</th>\n",
       "      <th>ma20</th>\n",
       "      <th>v_ma5</th>\n",
       "      <th>v_ma10</th>\n",
       "      <th>v_ma20</th>\n",
       "      <th>turnover</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>2018-02-27</th>\n",
       "      <td>23.53</td>\n",
       "      <td>25.88</td>\n",
       "      <td>24.16</td>\n",
       "      <td>23.53</td>\n",
       "      <td>95578.03</td>\n",
       "      <td>0.63</td>\n",
       "      <td>2.68</td>\n",
       "      <td>22.942</td>\n",
       "      <td>22.142</td>\n",
       "      <td>22.875</td>\n",
       "      <td>53782.64</td>\n",
       "      <td>46738.65</td>\n",
       "      <td>55576.11</td>\n",
       "      <td>2.39</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2018-02-26</th>\n",
       "      <td>22.80</td>\n",
       "      <td>23.78</td>\n",
       "      <td>23.53</td>\n",
       "      <td>22.80</td>\n",
       "      <td>60985.11</td>\n",
       "      <td>0.69</td>\n",
       "      <td>3.02</td>\n",
       "      <td>22.406</td>\n",
       "      <td>21.955</td>\n",
       "      <td>22.942</td>\n",
       "      <td>40827.52</td>\n",
       "      <td>42736.34</td>\n",
       "      <td>56007.50</td>\n",
       "      <td>1.53</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2018-02-23</th>\n",
       "      <td>22.88</td>\n",
       "      <td>23.37</td>\n",
       "      <td>22.82</td>\n",
       "      <td>22.71</td>\n",
       "      <td>52914.01</td>\n",
       "      <td>0.54</td>\n",
       "      <td>2.42</td>\n",
       "      <td>21.938</td>\n",
       "      <td>21.929</td>\n",
       "      <td>23.022</td>\n",
       "      <td>35119.58</td>\n",
       "      <td>41871.97</td>\n",
       "      <td>56372.85</td>\n",
       "      <td>1.32</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2018-02-22</th>\n",
       "      <td>22.25</td>\n",
       "      <td>22.76</td>\n",
       "      <td>22.28</td>\n",
       "      <td>22.02</td>\n",
       "      <td>36105.01</td>\n",
       "      <td>0.36</td>\n",
       "      <td>1.64</td>\n",
       "      <td>21.446</td>\n",
       "      <td>21.909</td>\n",
       "      <td>23.137</td>\n",
       "      <td>35397.58</td>\n",
       "      <td>39904.78</td>\n",
       "      <td>60149.60</td>\n",
       "      <td>0.90</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2018-02-14</th>\n",
       "      <td>21.49</td>\n",
       "      <td>21.99</td>\n",
       "      <td>21.92</td>\n",
       "      <td>21.48</td>\n",
       "      <td>23331.04</td>\n",
       "      <td>0.44</td>\n",
       "      <td>2.05</td>\n",
       "      <td>21.366</td>\n",
       "      <td>21.923</td>\n",
       "      <td>23.253</td>\n",
       "      <td>33590.21</td>\n",
       "      <td>42935.74</td>\n",
       "      <td>61716.11</td>\n",
       "      <td>0.58</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "             open   high  close    low    volume  price_change  p_change  \\\n",
       "2018-02-27  23.53  25.88  24.16  23.53  95578.03          0.63      2.68   \n",
       "2018-02-26  22.80  23.78  23.53  22.80  60985.11          0.69      3.02   \n",
       "2018-02-23  22.88  23.37  22.82  22.71  52914.01          0.54      2.42   \n",
       "2018-02-22  22.25  22.76  22.28  22.02  36105.01          0.36      1.64   \n",
       "2018-02-14  21.49  21.99  21.92  21.48  23331.04          0.44      2.05   \n",
       "\n",
       "               ma5    ma10    ma20     v_ma5    v_ma10    v_ma20  turnover  \n",
       "2018-02-27  22.942  22.142  22.875  53782.64  46738.65  55576.11      2.39  \n",
       "2018-02-26  22.406  21.955  22.942  40827.52  42736.34  56007.50      1.53  \n",
       "2018-02-23  21.938  21.929  23.022  35119.58  41871.97  56372.85      1.32  \n",
       "2018-02-22  21.446  21.909  23.137  35397.58  39904.78  60149.60      0.90  \n",
       "2018-02-14  21.366  21.923  23.253  33590.21  42935.74  61716.11      0.58  "
      ]
     },
     "execution_count": 20,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "data.head()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 21,
   "metadata": {},
   "outputs": [],
   "source": [
    "p_change = data[\"p_change\"]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 22,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "2018-02-27    2.68\n",
       "2018-02-26    3.02\n",
       "2018-02-23    2.42\n",
       "2018-02-22    1.64\n",
       "2018-02-14    2.05\n",
       "Name: p_change, dtype: float64"
      ]
     },
     "execution_count": 22,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "p_change.head()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 23,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "(5.27, 10.03]                    65\n",
       "(0.26, 0.94]                     65\n",
       "(-0.462, 0.26]                   65\n",
       "(-10.030999999999999, -4.836]    65\n",
       "(2.938, 5.27]                    64\n",
       "(1.738, 2.938]                   64\n",
       "(-1.352, -0.462]                 64\n",
       "(-2.444, -1.352]                 64\n",
       "(-4.836, -2.444]                 64\n",
       "(0.94, 1.738]                    63\n",
       "Name: p_change, dtype: int64"
      ]
     },
     "execution_count": 23,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 自动分成差不多数量的类别\n",
    "qcut = pd.qcut(p_change, 10)\n",
    "qcut.value_counts()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 24,
   "metadata": {},
   "outputs": [],
   "source": [
    "# 指定分组区间\n",
    "bins = [-100, -7, -5, -3, 0, 3, 5, 7, 100]\n",
    "p_count = pd.cut(p_change, bins)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 25,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "(0, 3]        215\n",
       "(-3, 0]       188\n",
       "(3, 5]         57\n",
       "(-5, -3]       51\n",
       "(7, 100]       35\n",
       "(5, 7]         35\n",
       "(-100, -7]     34\n",
       "(-7, -5]       28\n",
       "Name: p_change, dtype: int64"
      ]
     },
     "execution_count": 25,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "p_count.value_counts()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 26,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style>\n",
       "    .dataframe thead tr:only-child th {\n",
       "        text-align: right;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: left;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>rise_(-100, -7]</th>\n",
       "      <th>rise_(-7, -5]</th>\n",
       "      <th>rise_(-5, -3]</th>\n",
       "      <th>rise_(-3, 0]</th>\n",
       "      <th>rise_(0, 3]</th>\n",
       "      <th>rise_(3, 5]</th>\n",
       "      <th>rise_(5, 7]</th>\n",
       "      <th>rise_(7, 100]</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>2018-02-27</th>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2018-02-26</th>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2018-02-23</th>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2018-02-22</th>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2018-02-14</th>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "            rise_(-100, -7]  rise_(-7, -5]  rise_(-5, -3]  rise_(-3, 0]  \\\n",
       "2018-02-27                0              0              0             0   \n",
       "2018-02-26                0              0              0             0   \n",
       "2018-02-23                0              0              0             0   \n",
       "2018-02-22                0              0              0             0   \n",
       "2018-02-14                0              0              0             0   \n",
       "\n",
       "            rise_(0, 3]  rise_(3, 5]  rise_(5, 7]  rise_(7, 100]  \n",
       "2018-02-27            1            0            0              0  \n",
       "2018-02-26            0            1            0              0  \n",
       "2018-02-23            1            0            0              0  \n",
       "2018-02-22            1            0            0              0  \n",
       "2018-02-14            1            0            0              0  "
      ]
     },
     "execution_count": 26,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "dummies = pd.get_dummies(p_count, prefix=\"rise\")\n",
    "dummies.head()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# 合并"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 27,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style>\n",
       "    .dataframe thead tr:only-child th {\n",
       "        text-align: right;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: left;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>open</th>\n",
       "      <th>high</th>\n",
       "      <th>close</th>\n",
       "      <th>low</th>\n",
       "      <th>volume</th>\n",
       "      <th>price_change</th>\n",
       "      <th>p_change</th>\n",
       "      <th>ma5</th>\n",
       "      <th>ma10</th>\n",
       "      <th>ma20</th>\n",
       "      <th>...</th>\n",
       "      <th>v_ma20</th>\n",
       "      <th>turnover</th>\n",
       "      <th>rise_(-100, -7]</th>\n",
       "      <th>rise_(-7, -5]</th>\n",
       "      <th>rise_(-5, -3]</th>\n",
       "      <th>rise_(-3, 0]</th>\n",
       "      <th>rise_(0, 3]</th>\n",
       "      <th>rise_(3, 5]</th>\n",
       "      <th>rise_(5, 7]</th>\n",
       "      <th>rise_(7, 100]</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>2018-02-27</th>\n",
       "      <td>23.53</td>\n",
       "      <td>25.88</td>\n",
       "      <td>24.16</td>\n",
       "      <td>23.53</td>\n",
       "      <td>95578.03</td>\n",
       "      <td>0.63</td>\n",
       "      <td>2.68</td>\n",
       "      <td>22.942</td>\n",
       "      <td>22.142</td>\n",
       "      <td>22.875</td>\n",
       "      <td>...</td>\n",
       "      <td>55576.11</td>\n",
       "      <td>2.39</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2018-02-26</th>\n",
       "      <td>22.80</td>\n",
       "      <td>23.78</td>\n",
       "      <td>23.53</td>\n",
       "      <td>22.80</td>\n",
       "      <td>60985.11</td>\n",
       "      <td>0.69</td>\n",
       "      <td>3.02</td>\n",
       "      <td>22.406</td>\n",
       "      <td>21.955</td>\n",
       "      <td>22.942</td>\n",
       "      <td>...</td>\n",
       "      <td>56007.50</td>\n",
       "      <td>1.53</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2018-02-23</th>\n",
       "      <td>22.88</td>\n",
       "      <td>23.37</td>\n",
       "      <td>22.82</td>\n",
       "      <td>22.71</td>\n",
       "      <td>52914.01</td>\n",
       "      <td>0.54</td>\n",
       "      <td>2.42</td>\n",
       "      <td>21.938</td>\n",
       "      <td>21.929</td>\n",
       "      <td>23.022</td>\n",
       "      <td>...</td>\n",
       "      <td>56372.85</td>\n",
       "      <td>1.32</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2018-02-22</th>\n",
       "      <td>22.25</td>\n",
       "      <td>22.76</td>\n",
       "      <td>22.28</td>\n",
       "      <td>22.02</td>\n",
       "      <td>36105.01</td>\n",
       "      <td>0.36</td>\n",
       "      <td>1.64</td>\n",
       "      <td>21.446</td>\n",
       "      <td>21.909</td>\n",
       "      <td>23.137</td>\n",
       "      <td>...</td>\n",
       "      <td>60149.60</td>\n",
       "      <td>0.90</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2018-02-14</th>\n",
       "      <td>21.49</td>\n",
       "      <td>21.99</td>\n",
       "      <td>21.92</td>\n",
       "      <td>21.48</td>\n",
       "      <td>23331.04</td>\n",
       "      <td>0.44</td>\n",
       "      <td>2.05</td>\n",
       "      <td>21.366</td>\n",
       "      <td>21.923</td>\n",
       "      <td>23.253</td>\n",
       "      <td>...</td>\n",
       "      <td>61716.11</td>\n",
       "      <td>0.58</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2018-02-13</th>\n",
       "      <td>21.40</td>\n",
       "      <td>21.90</td>\n",
       "      <td>21.48</td>\n",
       "      <td>21.31</td>\n",
       "      <td>30802.45</td>\n",
       "      <td>0.28</td>\n",
       "      <td>1.32</td>\n",
       "      <td>21.342</td>\n",
       "      <td>22.103</td>\n",
       "      <td>23.387</td>\n",
       "      <td>...</td>\n",
       "      <td>65161.68</td>\n",
       "      <td>0.77</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2018-02-12</th>\n",
       "      <td>20.70</td>\n",
       "      <td>21.40</td>\n",
       "      <td>21.19</td>\n",
       "      <td>20.63</td>\n",
       "      <td>32445.39</td>\n",
       "      <td>0.82</td>\n",
       "      <td>4.03</td>\n",
       "      <td>21.504</td>\n",
       "      <td>22.338</td>\n",
       "      <td>23.533</td>\n",
       "      <td>...</td>\n",
       "      <td>68686.33</td>\n",
       "      <td>0.81</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2018-02-09</th>\n",
       "      <td>21.20</td>\n",
       "      <td>21.46</td>\n",
       "      <td>20.36</td>\n",
       "      <td>20.19</td>\n",
       "      <td>54304.01</td>\n",
       "      <td>-1.50</td>\n",
       "      <td>-6.86</td>\n",
       "      <td>21.920</td>\n",
       "      <td>22.596</td>\n",
       "      <td>23.645</td>\n",
       "      <td>...</td>\n",
       "      <td>70552.47</td>\n",
       "      <td>1.36</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2018-02-08</th>\n",
       "      <td>21.79</td>\n",
       "      <td>22.09</td>\n",
       "      <td>21.88</td>\n",
       "      <td>21.75</td>\n",
       "      <td>27068.16</td>\n",
       "      <td>0.09</td>\n",
       "      <td>0.41</td>\n",
       "      <td>22.372</td>\n",
       "      <td>23.009</td>\n",
       "      <td>23.839</td>\n",
       "      <td>...</td>\n",
       "      <td>73852.45</td>\n",
       "      <td>0.68</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2018-02-07</th>\n",
       "      <td>22.69</td>\n",
       "      <td>23.11</td>\n",
       "      <td>21.80</td>\n",
       "      <td>21.29</td>\n",
       "      <td>53853.25</td>\n",
       "      <td>-0.50</td>\n",
       "      <td>-2.24</td>\n",
       "      <td>22.480</td>\n",
       "      <td>23.258</td>\n",
       "      <td>23.929</td>\n",
       "      <td>...</td>\n",
       "      <td>74925.33</td>\n",
       "      <td>1.35</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2018-02-06</th>\n",
       "      <td>22.80</td>\n",
       "      <td>23.55</td>\n",
       "      <td>22.29</td>\n",
       "      <td>22.20</td>\n",
       "      <td>55555.00</td>\n",
       "      <td>-0.97</td>\n",
       "      <td>-4.17</td>\n",
       "      <td>22.864</td>\n",
       "      <td>23.607</td>\n",
       "      <td>24.029</td>\n",
       "      <td>...</td>\n",
       "      <td>75738.95</td>\n",
       "      <td>1.39</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2018-02-05</th>\n",
       "      <td>22.45</td>\n",
       "      <td>23.39</td>\n",
       "      <td>23.27</td>\n",
       "      <td>22.25</td>\n",
       "      <td>52341.39</td>\n",
       "      <td>0.65</td>\n",
       "      <td>2.87</td>\n",
       "      <td>23.172</td>\n",
       "      <td>23.928</td>\n",
       "      <td>24.112</td>\n",
       "      <td>...</td>\n",
       "      <td>77070.00</td>\n",
       "      <td>1.31</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2018-02-02</th>\n",
       "      <td>22.40</td>\n",
       "      <td>22.70</td>\n",
       "      <td>22.62</td>\n",
       "      <td>21.53</td>\n",
       "      <td>33242.11</td>\n",
       "      <td>0.20</td>\n",
       "      <td>0.89</td>\n",
       "      <td>23.272</td>\n",
       "      <td>24.114</td>\n",
       "      <td>24.184</td>\n",
       "      <td>...</td>\n",
       "      <td>79929.71</td>\n",
       "      <td>0.83</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2018-02-01</th>\n",
       "      <td>23.71</td>\n",
       "      <td>23.86</td>\n",
       "      <td>22.42</td>\n",
       "      <td>22.22</td>\n",
       "      <td>66414.64</td>\n",
       "      <td>-1.30</td>\n",
       "      <td>-5.48</td>\n",
       "      <td>23.646</td>\n",
       "      <td>24.365</td>\n",
       "      <td>24.279</td>\n",
       "      <td>...</td>\n",
       "      <td>88480.92</td>\n",
       "      <td>1.66</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2018-01-31</th>\n",
       "      <td>23.85</td>\n",
       "      <td>23.98</td>\n",
       "      <td>23.72</td>\n",
       "      <td>23.31</td>\n",
       "      <td>49155.02</td>\n",
       "      <td>-0.11</td>\n",
       "      <td>-0.46</td>\n",
       "      <td>24.036</td>\n",
       "      <td>24.583</td>\n",
       "      <td>24.411</td>\n",
       "      <td>...</td>\n",
       "      <td>91666.75</td>\n",
       "      <td>1.23</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2018-01-30</th>\n",
       "      <td>23.71</td>\n",
       "      <td>24.08</td>\n",
       "      <td>23.83</td>\n",
       "      <td>23.70</td>\n",
       "      <td>32420.43</td>\n",
       "      <td>0.05</td>\n",
       "      <td>0.21</td>\n",
       "      <td>24.350</td>\n",
       "      <td>24.671</td>\n",
       "      <td>24.365</td>\n",
       "      <td>...</td>\n",
       "      <td>92943.35</td>\n",
       "      <td>0.81</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2018-01-29</th>\n",
       "      <td>24.40</td>\n",
       "      <td>24.63</td>\n",
       "      <td>23.77</td>\n",
       "      <td>23.72</td>\n",
       "      <td>65469.81</td>\n",
       "      <td>-0.73</td>\n",
       "      <td>-2.98</td>\n",
       "      <td>24.684</td>\n",
       "      <td>24.728</td>\n",
       "      <td>24.294</td>\n",
       "      <td>...</td>\n",
       "      <td>93456.22</td>\n",
       "      <td>1.64</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2018-01-26</th>\n",
       "      <td>24.27</td>\n",
       "      <td>24.74</td>\n",
       "      <td>24.49</td>\n",
       "      <td>24.22</td>\n",
       "      <td>50601.83</td>\n",
       "      <td>0.11</td>\n",
       "      <td>0.45</td>\n",
       "      <td>24.956</td>\n",
       "      <td>24.694</td>\n",
       "      <td>24.221</td>\n",
       "      <td>...</td>\n",
       "      <td>91980.51</td>\n",
       "      <td>1.27</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2018-01-25</th>\n",
       "      <td>24.99</td>\n",
       "      <td>24.99</td>\n",
       "      <td>24.37</td>\n",
       "      <td>24.23</td>\n",
       "      <td>104097.59</td>\n",
       "      <td>-0.93</td>\n",
       "      <td>-3.68</td>\n",
       "      <td>25.084</td>\n",
       "      <td>24.669</td>\n",
       "      <td>24.109</td>\n",
       "      <td>...</td>\n",
       "      <td>92262.67</td>\n",
       "      <td>2.61</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2018-01-24</th>\n",
       "      <td>25.49</td>\n",
       "      <td>26.28</td>\n",
       "      <td>25.29</td>\n",
       "      <td>25.20</td>\n",
       "      <td>134838.00</td>\n",
       "      <td>-0.20</td>\n",
       "      <td>-0.79</td>\n",
       "      <td>25.130</td>\n",
       "      <td>24.599</td>\n",
       "      <td>23.997</td>\n",
       "      <td>...</td>\n",
       "      <td>89522.22</td>\n",
       "      <td>3.37</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2018-01-23</th>\n",
       "      <td>25.15</td>\n",
       "      <td>25.53</td>\n",
       "      <td>25.50</td>\n",
       "      <td>24.93</td>\n",
       "      <td>104205.76</td>\n",
       "      <td>0.39</td>\n",
       "      <td>1.55</td>\n",
       "      <td>24.992</td>\n",
       "      <td>24.450</td>\n",
       "      <td>23.844</td>\n",
       "      <td>...</td>\n",
       "      <td>85876.80</td>\n",
       "      <td>2.61</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2018-01-22</th>\n",
       "      <td>25.14</td>\n",
       "      <td>25.40</td>\n",
       "      <td>25.13</td>\n",
       "      <td>24.75</td>\n",
       "      <td>68292.08</td>\n",
       "      <td>-0.01</td>\n",
       "      <td>-0.04</td>\n",
       "      <td>24.772</td>\n",
       "      <td>24.296</td>\n",
       "      <td>23.644</td>\n",
       "      <td>...</td>\n",
       "      <td>84970.00</td>\n",
       "      <td>1.71</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2018-01-19</th>\n",
       "      <td>24.60</td>\n",
       "      <td>25.34</td>\n",
       "      <td>25.13</td>\n",
       "      <td>24.42</td>\n",
       "      <td>128449.11</td>\n",
       "      <td>0.53</td>\n",
       "      <td>2.15</td>\n",
       "      <td>24.432</td>\n",
       "      <td>24.254</td>\n",
       "      <td>23.537</td>\n",
       "      <td>...</td>\n",
       "      <td>82975.10</td>\n",
       "      <td>3.21</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2018-01-18</th>\n",
       "      <td>24.40</td>\n",
       "      <td>24.88</td>\n",
       "      <td>24.60</td>\n",
       "      <td>24.30</td>\n",
       "      <td>67435.14</td>\n",
       "      <td>0.01</td>\n",
       "      <td>0.04</td>\n",
       "      <td>24.254</td>\n",
       "      <td>24.192</td>\n",
       "      <td>23.441</td>\n",
       "      <td>...</td>\n",
       "      <td>78252.92</td>\n",
       "      <td>1.69</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2018-01-17</th>\n",
       "      <td>24.42</td>\n",
       "      <td>24.92</td>\n",
       "      <td>24.60</td>\n",
       "      <td>23.80</td>\n",
       "      <td>92242.51</td>\n",
       "      <td>0.20</td>\n",
       "      <td>0.82</td>\n",
       "      <td>24.068</td>\n",
       "      <td>24.239</td>\n",
       "      <td>23.378</td>\n",
       "      <td>...</td>\n",
       "      <td>77049.61</td>\n",
       "      <td>2.31</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2018-01-16</th>\n",
       "      <td>23.40</td>\n",
       "      <td>24.60</td>\n",
       "      <td>24.40</td>\n",
       "      <td>23.30</td>\n",
       "      <td>101295.42</td>\n",
       "      <td>0.96</td>\n",
       "      <td>4.10</td>\n",
       "      <td>23.908</td>\n",
       "      <td>24.058</td>\n",
       "      <td>23.321</td>\n",
       "      <td>...</td>\n",
       "      <td>74590.92</td>\n",
       "      <td>2.54</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2018-01-15</th>\n",
       "      <td>24.01</td>\n",
       "      <td>24.23</td>\n",
       "      <td>23.43</td>\n",
       "      <td>23.30</td>\n",
       "      <td>69768.17</td>\n",
       "      <td>-0.80</td>\n",
       "      <td>-3.30</td>\n",
       "      <td>23.820</td>\n",
       "      <td>23.860</td>\n",
       "      <td>23.257</td>\n",
       "      <td>...</td>\n",
       "      <td>71006.65</td>\n",
       "      <td>1.75</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2018-01-12</th>\n",
       "      <td>23.70</td>\n",
       "      <td>25.15</td>\n",
       "      <td>24.24</td>\n",
       "      <td>23.42</td>\n",
       "      <td>120303.53</td>\n",
       "      <td>0.56</td>\n",
       "      <td>2.37</td>\n",
       "      <td>24.076</td>\n",
       "      <td>23.748</td>\n",
       "      <td>23.236</td>\n",
       "      <td>...</td>\n",
       "      <td>69690.35</td>\n",
       "      <td>3.01</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2018-01-11</th>\n",
       "      <td>23.67</td>\n",
       "      <td>23.85</td>\n",
       "      <td>23.67</td>\n",
       "      <td>23.21</td>\n",
       "      <td>48525.75</td>\n",
       "      <td>-0.12</td>\n",
       "      <td>-0.50</td>\n",
       "      <td>24.130</td>\n",
       "      <td>23.548</td>\n",
       "      <td>23.197</td>\n",
       "      <td>...</td>\n",
       "      <td>65928.23</td>\n",
       "      <td>1.21</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2018-01-10</th>\n",
       "      <td>24.10</td>\n",
       "      <td>24.60</td>\n",
       "      <td>23.80</td>\n",
       "      <td>23.40</td>\n",
       "      <td>70125.79</td>\n",
       "      <td>-0.14</td>\n",
       "      <td>-0.58</td>\n",
       "      <td>24.410</td>\n",
       "      <td>23.394</td>\n",
       "      <td>23.204</td>\n",
       "      <td>...</td>\n",
       "      <td>66934.89</td>\n",
       "      <td>1.76</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2015-04-13</th>\n",
       "      <td>19.60</td>\n",
       "      <td>21.30</td>\n",
       "      <td>21.13</td>\n",
       "      <td>19.50</td>\n",
       "      <td>171822.69</td>\n",
       "      <td>1.70</td>\n",
       "      <td>8.75</td>\n",
       "      <td>19.228</td>\n",
       "      <td>17.812</td>\n",
       "      <td>16.563</td>\n",
       "      <td>...</td>\n",
       "      <td>111752.31</td>\n",
       "      <td>5.88</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2015-04-10</th>\n",
       "      <td>19.55</td>\n",
       "      <td>19.89</td>\n",
       "      <td>19.43</td>\n",
       "      <td>19.20</td>\n",
       "      <td>112962.15</td>\n",
       "      <td>-0.19</td>\n",
       "      <td>-0.97</td>\n",
       "      <td>18.334</td>\n",
       "      <td>17.276</td>\n",
       "      <td>16.230</td>\n",
       "      <td>...</td>\n",
       "      <td>106228.29</td>\n",
       "      <td>3.87</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2015-04-09</th>\n",
       "      <td>18.28</td>\n",
       "      <td>19.89</td>\n",
       "      <td>19.62</td>\n",
       "      <td>18.02</td>\n",
       "      <td>183119.05</td>\n",
       "      <td>1.20</td>\n",
       "      <td>6.51</td>\n",
       "      <td>17.736</td>\n",
       "      <td>16.826</td>\n",
       "      <td>15.964</td>\n",
       "      <td>...</td>\n",
       "      <td>104829.10</td>\n",
       "      <td>6.27</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2015-04-08</th>\n",
       "      <td>17.60</td>\n",
       "      <td>18.53</td>\n",
       "      <td>18.42</td>\n",
       "      <td>17.60</td>\n",
       "      <td>157725.97</td>\n",
       "      <td>0.88</td>\n",
       "      <td>5.02</td>\n",
       "      <td>17.070</td>\n",
       "      <td>16.394</td>\n",
       "      <td>15.698</td>\n",
       "      <td>...</td>\n",
       "      <td>101658.57</td>\n",
       "      <td>5.40</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2015-04-07</th>\n",
       "      <td>16.54</td>\n",
       "      <td>17.98</td>\n",
       "      <td>17.54</td>\n",
       "      <td>16.50</td>\n",
       "      <td>122471.85</td>\n",
       "      <td>0.88</td>\n",
       "      <td>5.28</td>\n",
       "      <td>16.620</td>\n",
       "      <td>16.120</td>\n",
       "      <td>15.510</td>\n",
       "      <td>...</td>\n",
       "      <td>98832.94</td>\n",
       "      <td>4.19</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2015-04-03</th>\n",
       "      <td>16.44</td>\n",
       "      <td>16.77</td>\n",
       "      <td>16.66</td>\n",
       "      <td>16.25</td>\n",
       "      <td>91962.88</td>\n",
       "      <td>0.22</td>\n",
       "      <td>1.34</td>\n",
       "      <td>16.396</td>\n",
       "      <td>15.904</td>\n",
       "      <td>15.348</td>\n",
       "      <td>...</td>\n",
       "      <td>99956.63</td>\n",
       "      <td>3.15</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2015-04-02</th>\n",
       "      <td>16.21</td>\n",
       "      <td>16.50</td>\n",
       "      <td>16.44</td>\n",
       "      <td>16.21</td>\n",
       "      <td>66336.32</td>\n",
       "      <td>0.15</td>\n",
       "      <td>0.92</td>\n",
       "      <td>16.218</td>\n",
       "      <td>15.772</td>\n",
       "      <td>15.229</td>\n",
       "      <td>...</td>\n",
       "      <td>104350.08</td>\n",
       "      <td>2.27</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2015-04-01</th>\n",
       "      <td>16.18</td>\n",
       "      <td>16.48</td>\n",
       "      <td>16.29</td>\n",
       "      <td>16.00</td>\n",
       "      <td>68609.42</td>\n",
       "      <td>0.12</td>\n",
       "      <td>0.74</td>\n",
       "      <td>15.916</td>\n",
       "      <td>15.666</td>\n",
       "      <td>15.065</td>\n",
       "      <td>...</td>\n",
       "      <td>105692.28</td>\n",
       "      <td>2.35</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2015-03-31</th>\n",
       "      <td>16.78</td>\n",
       "      <td>16.88</td>\n",
       "      <td>16.17</td>\n",
       "      <td>16.07</td>\n",
       "      <td>84467.62</td>\n",
       "      <td>-0.25</td>\n",
       "      <td>-1.52</td>\n",
       "      <td>15.718</td>\n",
       "      <td>15.568</td>\n",
       "      <td>14.896</td>\n",
       "      <td>...</td>\n",
       "      <td>105615.58</td>\n",
       "      <td>2.89</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2015-03-30</th>\n",
       "      <td>15.99</td>\n",
       "      <td>16.63</td>\n",
       "      <td>16.42</td>\n",
       "      <td>15.99</td>\n",
       "      <td>85090.45</td>\n",
       "      <td>0.65</td>\n",
       "      <td>4.12</td>\n",
       "      <td>15.620</td>\n",
       "      <td>15.469</td>\n",
       "      <td>14.722</td>\n",
       "      <td>...</td>\n",
       "      <td>108345.78</td>\n",
       "      <td>2.91</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2015-03-27</th>\n",
       "      <td>14.90</td>\n",
       "      <td>15.86</td>\n",
       "      <td>15.77</td>\n",
       "      <td>14.90</td>\n",
       "      <td>120352.13</td>\n",
       "      <td>0.84</td>\n",
       "      <td>5.63</td>\n",
       "      <td>15.412</td>\n",
       "      <td>15.314</td>\n",
       "      <td>14.527</td>\n",
       "      <td>...</td>\n",
       "      <td>108905.84</td>\n",
       "      <td>4.12</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2015-03-26</th>\n",
       "      <td>15.14</td>\n",
       "      <td>15.35</td>\n",
       "      <td>14.93</td>\n",
       "      <td>14.91</td>\n",
       "      <td>84877.75</td>\n",
       "      <td>-0.37</td>\n",
       "      <td>-2.42</td>\n",
       "      <td>15.326</td>\n",
       "      <td>15.184</td>\n",
       "      <td>14.462</td>\n",
       "      <td>...</td>\n",
       "      <td>108303.41</td>\n",
       "      <td>2.91</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2015-03-25</th>\n",
       "      <td>15.97</td>\n",
       "      <td>15.97</td>\n",
       "      <td>15.30</td>\n",
       "      <td>15.18</td>\n",
       "      <td>97174.40</td>\n",
       "      <td>-0.38</td>\n",
       "      <td>-2.42</td>\n",
       "      <td>15.416</td>\n",
       "      <td>15.102</td>\n",
       "      <td>14.436</td>\n",
       "      <td>...</td>\n",
       "      <td>109604.83</td>\n",
       "      <td>3.33</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2015-03-24</th>\n",
       "      <td>15.38</td>\n",
       "      <td>16.16</td>\n",
       "      <td>15.68</td>\n",
       "      <td>15.28</td>\n",
       "      <td>153390.08</td>\n",
       "      <td>0.30</td>\n",
       "      <td>1.95</td>\n",
       "      <td>15.418</td>\n",
       "      <td>15.002</td>\n",
       "      <td>14.385</td>\n",
       "      <td>...</td>\n",
       "      <td>110336.03</td>\n",
       "      <td>5.25</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2015-03-23</th>\n",
       "      <td>15.34</td>\n",
       "      <td>15.56</td>\n",
       "      <td>15.38</td>\n",
       "      <td>15.25</td>\n",
       "      <td>89461.32</td>\n",
       "      <td>0.04</td>\n",
       "      <td>0.26</td>\n",
       "      <td>15.318</td>\n",
       "      <td>14.899</td>\n",
       "      <td>14.304</td>\n",
       "      <td>...</td>\n",
       "      <td>107645.16</td>\n",
       "      <td>3.06</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2015-03-20</th>\n",
       "      <td>15.38</td>\n",
       "      <td>15.48</td>\n",
       "      <td>15.34</td>\n",
       "      <td>15.18</td>\n",
       "      <td>76800.13</td>\n",
       "      <td>-0.04</td>\n",
       "      <td>-0.26</td>\n",
       "      <td>15.216</td>\n",
       "      <td>14.792</td>\n",
       "      <td>14.232</td>\n",
       "      <td>...</td>\n",
       "      <td>108857.41</td>\n",
       "      <td>2.63</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2015-03-19</th>\n",
       "      <td>15.20</td>\n",
       "      <td>15.64</td>\n",
       "      <td>15.38</td>\n",
       "      <td>15.11</td>\n",
       "      <td>93644.19</td>\n",
       "      <td>0.07</td>\n",
       "      <td>0.46</td>\n",
       "      <td>15.042</td>\n",
       "      <td>14.686</td>\n",
       "      <td>14.153</td>\n",
       "      <td>...</td>\n",
       "      <td>111147.22</td>\n",
       "      <td>3.21</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2015-03-18</th>\n",
       "      <td>15.18</td>\n",
       "      <td>15.66</td>\n",
       "      <td>15.31</td>\n",
       "      <td>15.02</td>\n",
       "      <td>121538.71</td>\n",
       "      <td>0.13</td>\n",
       "      <td>0.86</td>\n",
       "      <td>14.788</td>\n",
       "      <td>14.464</td>\n",
       "      <td>14.058</td>\n",
       "      <td>...</td>\n",
       "      <td>112493.60</td>\n",
       "      <td>4.16</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2015-03-17</th>\n",
       "      <td>14.90</td>\n",
       "      <td>15.44</td>\n",
       "      <td>15.18</td>\n",
       "      <td>14.63</td>\n",
       "      <td>158770.77</td>\n",
       "      <td>0.31</td>\n",
       "      <td>2.08</td>\n",
       "      <td>14.586</td>\n",
       "      <td>14.223</td>\n",
       "      <td>13.954</td>\n",
       "      <td>...</td>\n",
       "      <td>111739.85</td>\n",
       "      <td>5.43</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2015-03-16</th>\n",
       "      <td>14.52</td>\n",
       "      <td>15.05</td>\n",
       "      <td>14.87</td>\n",
       "      <td>14.51</td>\n",
       "      <td>94468.30</td>\n",
       "      <td>0.40</td>\n",
       "      <td>2.76</td>\n",
       "      <td>14.480</td>\n",
       "      <td>13.975</td>\n",
       "      <td>13.843</td>\n",
       "      <td>...</td>\n",
       "      <td>107464.31</td>\n",
       "      <td>3.23</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2015-03-13</th>\n",
       "      <td>14.13</td>\n",
       "      <td>14.50</td>\n",
       "      <td>14.47</td>\n",
       "      <td>14.08</td>\n",
       "      <td>61342.22</td>\n",
       "      <td>0.36</td>\n",
       "      <td>2.55</td>\n",
       "      <td>14.368</td>\n",
       "      <td>13.740</td>\n",
       "      <td>13.740</td>\n",
       "      <td>...</td>\n",
       "      <td>108763.91</td>\n",
       "      <td>2.10</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2015-03-12</th>\n",
       "      <td>14.11</td>\n",
       "      <td>14.80</td>\n",
       "      <td>14.11</td>\n",
       "      <td>13.95</td>\n",
       "      <td>84978.37</td>\n",
       "      <td>-0.19</td>\n",
       "      <td>-1.33</td>\n",
       "      <td>14.330</td>\n",
       "      <td>13.659</td>\n",
       "      <td>13.659</td>\n",
       "      <td>...</td>\n",
       "      <td>114032.98</td>\n",
       "      <td>2.91</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2015-03-11</th>\n",
       "      <td>14.80</td>\n",
       "      <td>15.08</td>\n",
       "      <td>14.30</td>\n",
       "      <td>14.14</td>\n",
       "      <td>119708.43</td>\n",
       "      <td>-0.35</td>\n",
       "      <td>-2.39</td>\n",
       "      <td>14.140</td>\n",
       "      <td>13.603</td>\n",
       "      <td>13.603</td>\n",
       "      <td>...</td>\n",
       "      <td>117664.81</td>\n",
       "      <td>4.10</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2015-03-10</th>\n",
       "      <td>14.20</td>\n",
       "      <td>14.80</td>\n",
       "      <td>14.65</td>\n",
       "      <td>14.01</td>\n",
       "      <td>101213.51</td>\n",
       "      <td>0.34</td>\n",
       "      <td>2.38</td>\n",
       "      <td>13.860</td>\n",
       "      <td>13.503</td>\n",
       "      <td>13.503</td>\n",
       "      <td>...</td>\n",
       "      <td>117372.87</td>\n",
       "      <td>3.46</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2015-03-09</th>\n",
       "      <td>14.14</td>\n",
       "      <td>14.85</td>\n",
       "      <td>14.31</td>\n",
       "      <td>13.80</td>\n",
       "      <td>144945.66</td>\n",
       "      <td>0.03</td>\n",
       "      <td>0.21</td>\n",
       "      <td>13.470</td>\n",
       "      <td>13.312</td>\n",
       "      <td>13.312</td>\n",
       "      <td>...</td>\n",
       "      <td>120066.09</td>\n",
       "      <td>4.96</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2015-03-06</th>\n",
       "      <td>13.17</td>\n",
       "      <td>14.48</td>\n",
       "      <td>14.28</td>\n",
       "      <td>13.13</td>\n",
       "      <td>179831.72</td>\n",
       "      <td>1.12</td>\n",
       "      <td>8.51</td>\n",
       "      <td>13.112</td>\n",
       "      <td>13.112</td>\n",
       "      <td>13.112</td>\n",
       "      <td>...</td>\n",
       "      <td>115090.18</td>\n",
       "      <td>6.16</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2015-03-05</th>\n",
       "      <td>12.88</td>\n",
       "      <td>13.45</td>\n",
       "      <td>13.16</td>\n",
       "      <td>12.87</td>\n",
       "      <td>93180.39</td>\n",
       "      <td>0.26</td>\n",
       "      <td>2.02</td>\n",
       "      <td>12.820</td>\n",
       "      <td>12.820</td>\n",
       "      <td>12.820</td>\n",
       "      <td>...</td>\n",
       "      <td>98904.79</td>\n",
       "      <td>3.19</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2015-03-04</th>\n",
       "      <td>12.80</td>\n",
       "      <td>12.92</td>\n",
       "      <td>12.90</td>\n",
       "      <td>12.61</td>\n",
       "      <td>67075.44</td>\n",
       "      <td>0.20</td>\n",
       "      <td>1.57</td>\n",
       "      <td>12.707</td>\n",
       "      <td>12.707</td>\n",
       "      <td>12.707</td>\n",
       "      <td>...</td>\n",
       "      <td>100812.93</td>\n",
       "      <td>2.30</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2015-03-03</th>\n",
       "      <td>12.52</td>\n",
       "      <td>13.06</td>\n",
       "      <td>12.70</td>\n",
       "      <td>12.52</td>\n",
       "      <td>139071.61</td>\n",
       "      <td>0.18</td>\n",
       "      <td>1.44</td>\n",
       "      <td>12.610</td>\n",
       "      <td>12.610</td>\n",
       "      <td>12.610</td>\n",
       "      <td>...</td>\n",
       "      <td>117681.67</td>\n",
       "      <td>4.76</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2015-03-02</th>\n",
       "      <td>12.25</td>\n",
       "      <td>12.67</td>\n",
       "      <td>12.52</td>\n",
       "      <td>12.20</td>\n",
       "      <td>96291.73</td>\n",
       "      <td>0.32</td>\n",
       "      <td>2.62</td>\n",
       "      <td>12.520</td>\n",
       "      <td>12.520</td>\n",
       "      <td>12.520</td>\n",
       "      <td>...</td>\n",
       "      <td>96291.73</td>\n",
       "      <td>3.30</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>643 rows × 22 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "             open   high  close    low     volume  price_change  p_change  \\\n",
       "2018-02-27  23.53  25.88  24.16  23.53   95578.03          0.63      2.68   \n",
       "2018-02-26  22.80  23.78  23.53  22.80   60985.11          0.69      3.02   \n",
       "2018-02-23  22.88  23.37  22.82  22.71   52914.01          0.54      2.42   \n",
       "2018-02-22  22.25  22.76  22.28  22.02   36105.01          0.36      1.64   \n",
       "2018-02-14  21.49  21.99  21.92  21.48   23331.04          0.44      2.05   \n",
       "2018-02-13  21.40  21.90  21.48  21.31   30802.45          0.28      1.32   \n",
       "2018-02-12  20.70  21.40  21.19  20.63   32445.39          0.82      4.03   \n",
       "2018-02-09  21.20  21.46  20.36  20.19   54304.01         -1.50     -6.86   \n",
       "2018-02-08  21.79  22.09  21.88  21.75   27068.16          0.09      0.41   \n",
       "2018-02-07  22.69  23.11  21.80  21.29   53853.25         -0.50     -2.24   \n",
       "2018-02-06  22.80  23.55  22.29  22.20   55555.00         -0.97     -4.17   \n",
       "2018-02-05  22.45  23.39  23.27  22.25   52341.39          0.65      2.87   \n",
       "2018-02-02  22.40  22.70  22.62  21.53   33242.11          0.20      0.89   \n",
       "2018-02-01  23.71  23.86  22.42  22.22   66414.64         -1.30     -5.48   \n",
       "2018-01-31  23.85  23.98  23.72  23.31   49155.02         -0.11     -0.46   \n",
       "2018-01-30  23.71  24.08  23.83  23.70   32420.43          0.05      0.21   \n",
       "2018-01-29  24.40  24.63  23.77  23.72   65469.81         -0.73     -2.98   \n",
       "2018-01-26  24.27  24.74  24.49  24.22   50601.83          0.11      0.45   \n",
       "2018-01-25  24.99  24.99  24.37  24.23  104097.59         -0.93     -3.68   \n",
       "2018-01-24  25.49  26.28  25.29  25.20  134838.00         -0.20     -0.79   \n",
       "2018-01-23  25.15  25.53  25.50  24.93  104205.76          0.39      1.55   \n",
       "2018-01-22  25.14  25.40  25.13  24.75   68292.08         -0.01     -0.04   \n",
       "2018-01-19  24.60  25.34  25.13  24.42  128449.11          0.53      2.15   \n",
       "2018-01-18  24.40  24.88  24.60  24.30   67435.14          0.01      0.04   \n",
       "2018-01-17  24.42  24.92  24.60  23.80   92242.51          0.20      0.82   \n",
       "2018-01-16  23.40  24.60  24.40  23.30  101295.42          0.96      4.10   \n",
       "2018-01-15  24.01  24.23  23.43  23.30   69768.17         -0.80     -3.30   \n",
       "2018-01-12  23.70  25.15  24.24  23.42  120303.53          0.56      2.37   \n",
       "2018-01-11  23.67  23.85  23.67  23.21   48525.75         -0.12     -0.50   \n",
       "2018-01-10  24.10  24.60  23.80  23.40   70125.79         -0.14     -0.58   \n",
       "...           ...    ...    ...    ...        ...           ...       ...   \n",
       "2015-04-13  19.60  21.30  21.13  19.50  171822.69          1.70      8.75   \n",
       "2015-04-10  19.55  19.89  19.43  19.20  112962.15         -0.19     -0.97   \n",
       "2015-04-09  18.28  19.89  19.62  18.02  183119.05          1.20      6.51   \n",
       "2015-04-08  17.60  18.53  18.42  17.60  157725.97          0.88      5.02   \n",
       "2015-04-07  16.54  17.98  17.54  16.50  122471.85          0.88      5.28   \n",
       "2015-04-03  16.44  16.77  16.66  16.25   91962.88          0.22      1.34   \n",
       "2015-04-02  16.21  16.50  16.44  16.21   66336.32          0.15      0.92   \n",
       "2015-04-01  16.18  16.48  16.29  16.00   68609.42          0.12      0.74   \n",
       "2015-03-31  16.78  16.88  16.17  16.07   84467.62         -0.25     -1.52   \n",
       "2015-03-30  15.99  16.63  16.42  15.99   85090.45          0.65      4.12   \n",
       "2015-03-27  14.90  15.86  15.77  14.90  120352.13          0.84      5.63   \n",
       "2015-03-26  15.14  15.35  14.93  14.91   84877.75         -0.37     -2.42   \n",
       "2015-03-25  15.97  15.97  15.30  15.18   97174.40         -0.38     -2.42   \n",
       "2015-03-24  15.38  16.16  15.68  15.28  153390.08          0.30      1.95   \n",
       "2015-03-23  15.34  15.56  15.38  15.25   89461.32          0.04      0.26   \n",
       "2015-03-20  15.38  15.48  15.34  15.18   76800.13         -0.04     -0.26   \n",
       "2015-03-19  15.20  15.64  15.38  15.11   93644.19          0.07      0.46   \n",
       "2015-03-18  15.18  15.66  15.31  15.02  121538.71          0.13      0.86   \n",
       "2015-03-17  14.90  15.44  15.18  14.63  158770.77          0.31      2.08   \n",
       "2015-03-16  14.52  15.05  14.87  14.51   94468.30          0.40      2.76   \n",
       "2015-03-13  14.13  14.50  14.47  14.08   61342.22          0.36      2.55   \n",
       "2015-03-12  14.11  14.80  14.11  13.95   84978.37         -0.19     -1.33   \n",
       "2015-03-11  14.80  15.08  14.30  14.14  119708.43         -0.35     -2.39   \n",
       "2015-03-10  14.20  14.80  14.65  14.01  101213.51          0.34      2.38   \n",
       "2015-03-09  14.14  14.85  14.31  13.80  144945.66          0.03      0.21   \n",
       "2015-03-06  13.17  14.48  14.28  13.13  179831.72          1.12      8.51   \n",
       "2015-03-05  12.88  13.45  13.16  12.87   93180.39          0.26      2.02   \n",
       "2015-03-04  12.80  12.92  12.90  12.61   67075.44          0.20      1.57   \n",
       "2015-03-03  12.52  13.06  12.70  12.52  139071.61          0.18      1.44   \n",
       "2015-03-02  12.25  12.67  12.52  12.20   96291.73          0.32      2.62   \n",
       "\n",
       "               ma5    ma10    ma20      ...           v_ma20  turnover  \\\n",
       "2018-02-27  22.942  22.142  22.875      ...         55576.11      2.39   \n",
       "2018-02-26  22.406  21.955  22.942      ...         56007.50      1.53   \n",
       "2018-02-23  21.938  21.929  23.022      ...         56372.85      1.32   \n",
       "2018-02-22  21.446  21.909  23.137      ...         60149.60      0.90   \n",
       "2018-02-14  21.366  21.923  23.253      ...         61716.11      0.58   \n",
       "2018-02-13  21.342  22.103  23.387      ...         65161.68      0.77   \n",
       "2018-02-12  21.504  22.338  23.533      ...         68686.33      0.81   \n",
       "2018-02-09  21.920  22.596  23.645      ...         70552.47      1.36   \n",
       "2018-02-08  22.372  23.009  23.839      ...         73852.45      0.68   \n",
       "2018-02-07  22.480  23.258  23.929      ...         74925.33      1.35   \n",
       "2018-02-06  22.864  23.607  24.029      ...         75738.95      1.39   \n",
       "2018-02-05  23.172  23.928  24.112      ...         77070.00      1.31   \n",
       "2018-02-02  23.272  24.114  24.184      ...         79929.71      0.83   \n",
       "2018-02-01  23.646  24.365  24.279      ...         88480.92      1.66   \n",
       "2018-01-31  24.036  24.583  24.411      ...         91666.75      1.23   \n",
       "2018-01-30  24.350  24.671  24.365      ...         92943.35      0.81   \n",
       "2018-01-29  24.684  24.728  24.294      ...         93456.22      1.64   \n",
       "2018-01-26  24.956  24.694  24.221      ...         91980.51      1.27   \n",
       "2018-01-25  25.084  24.669  24.109      ...         92262.67      2.61   \n",
       "2018-01-24  25.130  24.599  23.997      ...         89522.22      3.37   \n",
       "2018-01-23  24.992  24.450  23.844      ...         85876.80      2.61   \n",
       "2018-01-22  24.772  24.296  23.644      ...         84970.00      1.71   \n",
       "2018-01-19  24.432  24.254  23.537      ...         82975.10      3.21   \n",
       "2018-01-18  24.254  24.192  23.441      ...         78252.92      1.69   \n",
       "2018-01-17  24.068  24.239  23.378      ...         77049.61      2.31   \n",
       "2018-01-16  23.908  24.058  23.321      ...         74590.92      2.54   \n",
       "2018-01-15  23.820  23.860  23.257      ...         71006.65      1.75   \n",
       "2018-01-12  24.076  23.748  23.236      ...         69690.35      3.01   \n",
       "2018-01-11  24.130  23.548  23.197      ...         65928.23      1.21   \n",
       "2018-01-10  24.410  23.394  23.204      ...         66934.89      1.76   \n",
       "...            ...     ...     ...      ...              ...       ...   \n",
       "2015-04-13  19.228  17.812  16.563      ...        111752.31      5.88   \n",
       "2015-04-10  18.334  17.276  16.230      ...        106228.29      3.87   \n",
       "2015-04-09  17.736  16.826  15.964      ...        104829.10      6.27   \n",
       "2015-04-08  17.070  16.394  15.698      ...        101658.57      5.40   \n",
       "2015-04-07  16.620  16.120  15.510      ...         98832.94      4.19   \n",
       "2015-04-03  16.396  15.904  15.348      ...         99956.63      3.15   \n",
       "2015-04-02  16.218  15.772  15.229      ...        104350.08      2.27   \n",
       "2015-04-01  15.916  15.666  15.065      ...        105692.28      2.35   \n",
       "2015-03-31  15.718  15.568  14.896      ...        105615.58      2.89   \n",
       "2015-03-30  15.620  15.469  14.722      ...        108345.78      2.91   \n",
       "2015-03-27  15.412  15.314  14.527      ...        108905.84      4.12   \n",
       "2015-03-26  15.326  15.184  14.462      ...        108303.41      2.91   \n",
       "2015-03-25  15.416  15.102  14.436      ...        109604.83      3.33   \n",
       "2015-03-24  15.418  15.002  14.385      ...        110336.03      5.25   \n",
       "2015-03-23  15.318  14.899  14.304      ...        107645.16      3.06   \n",
       "2015-03-20  15.216  14.792  14.232      ...        108857.41      2.63   \n",
       "2015-03-19  15.042  14.686  14.153      ...        111147.22      3.21   \n",
       "2015-03-18  14.788  14.464  14.058      ...        112493.60      4.16   \n",
       "2015-03-17  14.586  14.223  13.954      ...        111739.85      5.43   \n",
       "2015-03-16  14.480  13.975  13.843      ...        107464.31      3.23   \n",
       "2015-03-13  14.368  13.740  13.740      ...        108763.91      2.10   \n",
       "2015-03-12  14.330  13.659  13.659      ...        114032.98      2.91   \n",
       "2015-03-11  14.140  13.603  13.603      ...        117664.81      4.10   \n",
       "2015-03-10  13.860  13.503  13.503      ...        117372.87      3.46   \n",
       "2015-03-09  13.470  13.312  13.312      ...        120066.09      4.96   \n",
       "2015-03-06  13.112  13.112  13.112      ...        115090.18      6.16   \n",
       "2015-03-05  12.820  12.820  12.820      ...         98904.79      3.19   \n",
       "2015-03-04  12.707  12.707  12.707      ...        100812.93      2.30   \n",
       "2015-03-03  12.610  12.610  12.610      ...        117681.67      4.76   \n",
       "2015-03-02  12.520  12.520  12.520      ...         96291.73      3.30   \n",
       "\n",
       "            rise_(-100, -7]  rise_(-7, -5]  rise_(-5, -3]  rise_(-3, 0]  \\\n",
       "2018-02-27                0              0              0             0   \n",
       "2018-02-26                0              0              0             0   \n",
       "2018-02-23                0              0              0             0   \n",
       "2018-02-22                0              0              0             0   \n",
       "2018-02-14                0              0              0             0   \n",
       "2018-02-13                0              0              0             0   \n",
       "2018-02-12                0              0              0             0   \n",
       "2018-02-09                0              1              0             0   \n",
       "2018-02-08                0              0              0             0   \n",
       "2018-02-07                0              0              0             1   \n",
       "2018-02-06                0              0              1             0   \n",
       "2018-02-05                0              0              0             0   \n",
       "2018-02-02                0              0              0             0   \n",
       "2018-02-01                0              1              0             0   \n",
       "2018-01-31                0              0              0             1   \n",
       "2018-01-30                0              0              0             0   \n",
       "2018-01-29                0              0              0             1   \n",
       "2018-01-26                0              0              0             0   \n",
       "2018-01-25                0              0              1             0   \n",
       "2018-01-24                0              0              0             1   \n",
       "2018-01-23                0              0              0             0   \n",
       "2018-01-22                0              0              0             1   \n",
       "2018-01-19                0              0              0             0   \n",
       "2018-01-18                0              0              0             0   \n",
       "2018-01-17                0              0              0             0   \n",
       "2018-01-16                0              0              0             0   \n",
       "2018-01-15                0              0              1             0   \n",
       "2018-01-12                0              0              0             0   \n",
       "2018-01-11                0              0              0             1   \n",
       "2018-01-10                0              0              0             1   \n",
       "...                     ...            ...            ...           ...   \n",
       "2015-04-13                0              0              0             0   \n",
       "2015-04-10                0              0              0             1   \n",
       "2015-04-09                0              0              0             0   \n",
       "2015-04-08                0              0              0             0   \n",
       "2015-04-07                0              0              0             0   \n",
       "2015-04-03                0              0              0             0   \n",
       "2015-04-02                0              0              0             0   \n",
       "2015-04-01                0              0              0             0   \n",
       "2015-03-31                0              0              0             1   \n",
       "2015-03-30                0              0              0             0   \n",
       "2015-03-27                0              0              0             0   \n",
       "2015-03-26                0              0              0             1   \n",
       "2015-03-25                0              0              0             1   \n",
       "2015-03-24                0              0              0             0   \n",
       "2015-03-23                0              0              0             0   \n",
       "2015-03-20                0              0              0             1   \n",
       "2015-03-19                0              0              0             0   \n",
       "2015-03-18                0              0              0             0   \n",
       "2015-03-17                0              0              0             0   \n",
       "2015-03-16                0              0              0             0   \n",
       "2015-03-13                0              0              0             0   \n",
       "2015-03-12                0              0              0             1   \n",
       "2015-03-11                0              0              0             1   \n",
       "2015-03-10                0              0              0             0   \n",
       "2015-03-09                0              0              0             0   \n",
       "2015-03-06                0              0              0             0   \n",
       "2015-03-05                0              0              0             0   \n",
       "2015-03-04                0              0              0             0   \n",
       "2015-03-03                0              0              0             0   \n",
       "2015-03-02                0              0              0             0   \n",
       "\n",
       "            rise_(0, 3]  rise_(3, 5]  rise_(5, 7]  rise_(7, 100]  \n",
       "2018-02-27            1            0            0              0  \n",
       "2018-02-26            0            1            0              0  \n",
       "2018-02-23            1            0            0              0  \n",
       "2018-02-22            1            0            0              0  \n",
       "2018-02-14            1            0            0              0  \n",
       "2018-02-13            1            0            0              0  \n",
       "2018-02-12            0            1            0              0  \n",
       "2018-02-09            0            0            0              0  \n",
       "2018-02-08            1            0            0              0  \n",
       "2018-02-07            0            0            0              0  \n",
       "2018-02-06            0            0            0              0  \n",
       "2018-02-05            1            0            0              0  \n",
       "2018-02-02            1            0            0              0  \n",
       "2018-02-01            0            0            0              0  \n",
       "2018-01-31            0            0            0              0  \n",
       "2018-01-30            1            0            0              0  \n",
       "2018-01-29            0            0            0              0  \n",
       "2018-01-26            1            0            0              0  \n",
       "2018-01-25            0            0            0              0  \n",
       "2018-01-24            0            0            0              0  \n",
       "2018-01-23            1            0            0              0  \n",
       "2018-01-22            0            0            0              0  \n",
       "2018-01-19            1            0            0              0  \n",
       "2018-01-18            1            0            0              0  \n",
       "2018-01-17            1            0            0              0  \n",
       "2018-01-16            0            1            0              0  \n",
       "2018-01-15            0            0            0              0  \n",
       "2018-01-12            1            0            0              0  \n",
       "2018-01-11            0            0            0              0  \n",
       "2018-01-10            0            0            0              0  \n",
       "...                 ...          ...          ...            ...  \n",
       "2015-04-13            0            0            0              1  \n",
       "2015-04-10            0            0            0              0  \n",
       "2015-04-09            0            0            1              0  \n",
       "2015-04-08            0            0            1              0  \n",
       "2015-04-07            0            0            1              0  \n",
       "2015-04-03            1            0            0              0  \n",
       "2015-04-02            1            0            0              0  \n",
       "2015-04-01            1            0            0              0  \n",
       "2015-03-31            0            0            0              0  \n",
       "2015-03-30            0            1            0              0  \n",
       "2015-03-27            0            0            1              0  \n",
       "2015-03-26            0            0            0              0  \n",
       "2015-03-25            0            0            0              0  \n",
       "2015-03-24            1            0            0              0  \n",
       "2015-03-23            1            0            0              0  \n",
       "2015-03-20            0            0            0              0  \n",
       "2015-03-19            1            0            0              0  \n",
       "2015-03-18            1            0            0              0  \n",
       "2015-03-17            1            0            0              0  \n",
       "2015-03-16            1            0            0              0  \n",
       "2015-03-13            1            0            0              0  \n",
       "2015-03-12            0            0            0              0  \n",
       "2015-03-11            0            0            0              0  \n",
       "2015-03-10            1            0            0              0  \n",
       "2015-03-09            1            0            0              0  \n",
       "2015-03-06            0            0            0              1  \n",
       "2015-03-05            1            0            0              0  \n",
       "2015-03-04            1            0            0              0  \n",
       "2015-03-03            1            0            0              0  \n",
       "2015-03-02            1            0            0              0  \n",
       "\n",
       "[643 rows x 22 columns]"
      ]
     },
     "execution_count": 27,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "pd.concat([data, dummies],axis=1)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 28,
   "metadata": {},
   "outputs": [],
   "source": [
    "left = pd.DataFrame({'key1': ['K0', 'K0', 'K1', 'K2'],\n",
    "                        'key2': ['K0', 'K1', 'K0', 'K1'],\n",
    "                        'A': ['A0', 'A1', 'A2', 'A3'],\n",
    "                        'B': ['B0', 'B1', 'B2', 'B3']})\n",
    "\n",
    "right = pd.DataFrame({'key1': ['K0', 'K1', 'K1', 'K2'],\n",
    "                        'key2': ['K0', 'K0', 'K0', 'K0'],\n",
    "                        'C': ['C0', 'C1', 'C2', 'C3'],\n",
    "                        'D': ['D0', 'D1', 'D2', 'D3']})"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 29,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style>\n",
       "    .dataframe thead tr:only-child th {\n",
       "        text-align: right;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: left;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>A</th>\n",
       "      <th>B</th>\n",
       "      <th>key1</th>\n",
       "      <th>key2</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>A0</td>\n",
       "      <td>B0</td>\n",
       "      <td>K0</td>\n",
       "      <td>K0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>A1</td>\n",
       "      <td>B1</td>\n",
       "      <td>K0</td>\n",
       "      <td>K1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>A2</td>\n",
       "      <td>B2</td>\n",
       "      <td>K1</td>\n",
       "      <td>K0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>A3</td>\n",
       "      <td>B3</td>\n",
       "      <td>K2</td>\n",
       "      <td>K1</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "    A   B key1 key2\n",
       "0  A0  B0   K0   K0\n",
       "1  A1  B1   K0   K1\n",
       "2  A2  B2   K1   K0\n",
       "3  A3  B3   K2   K1"
      ]
     },
     "execution_count": 29,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "left"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 30,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style>\n",
       "    .dataframe thead tr:only-child th {\n",
       "        text-align: right;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: left;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>C</th>\n",
       "      <th>D</th>\n",
       "      <th>key1</th>\n",
       "      <th>key2</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>C0</td>\n",
       "      <td>D0</td>\n",
       "      <td>K0</td>\n",
       "      <td>K0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>C1</td>\n",
       "      <td>D1</td>\n",
       "      <td>K1</td>\n",
       "      <td>K0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>C2</td>\n",
       "      <td>D2</td>\n",
       "      <td>K1</td>\n",
       "      <td>K0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>C3</td>\n",
       "      <td>D3</td>\n",
       "      <td>K2</td>\n",
       "      <td>K0</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "    C   D key1 key2\n",
       "0  C0  D0   K0   K0\n",
       "1  C1  D1   K1   K0\n",
       "2  C2  D2   K1   K0\n",
       "3  C3  D3   K2   K0"
      ]
     },
     "execution_count": 30,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "right"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 31,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style>\n",
       "    .dataframe thead tr:only-child th {\n",
       "        text-align: right;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: left;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>A</th>\n",
       "      <th>B</th>\n",
       "      <th>key1</th>\n",
       "      <th>key2</th>\n",
       "      <th>C</th>\n",
       "      <th>D</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>A0</td>\n",
       "      <td>B0</td>\n",
       "      <td>K0</td>\n",
       "      <td>K0</td>\n",
       "      <td>C0</td>\n",
       "      <td>D0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>A2</td>\n",
       "      <td>B2</td>\n",
       "      <td>K1</td>\n",
       "      <td>K0</td>\n",
       "      <td>C1</td>\n",
       "      <td>D1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>A2</td>\n",
       "      <td>B2</td>\n",
       "      <td>K1</td>\n",
       "      <td>K0</td>\n",
       "      <td>C2</td>\n",
       "      <td>D2</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "    A   B key1 key2   C   D\n",
       "0  A0  B0   K0   K0  C0  D0\n",
       "1  A2  B2   K1   K0  C1  D1\n",
       "2  A2  B2   K1   K0  C2  D2"
      ]
     },
     "execution_count": 31,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "pd.merge(left, right, on=[\"key1\", \"key2\"])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 32,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style>\n",
       "    .dataframe thead tr:only-child th {\n",
       "        text-align: right;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: left;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>A</th>\n",
       "      <th>B</th>\n",
       "      <th>key1</th>\n",
       "      <th>key2</th>\n",
       "      <th>C</th>\n",
       "      <th>D</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>A0</td>\n",
       "      <td>B0</td>\n",
       "      <td>K0</td>\n",
       "      <td>K0</td>\n",
       "      <td>C0</td>\n",
       "      <td>D0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>A2</td>\n",
       "      <td>B2</td>\n",
       "      <td>K1</td>\n",
       "      <td>K0</td>\n",
       "      <td>C1</td>\n",
       "      <td>D1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>A2</td>\n",
       "      <td>B2</td>\n",
       "      <td>K1</td>\n",
       "      <td>K0</td>\n",
       "      <td>C2</td>\n",
       "      <td>D2</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "    A   B key1 key2   C   D\n",
       "0  A0  B0   K0   K0  C0  D0\n",
       "1  A2  B2   K1   K0  C1  D1\n",
       "2  A2  B2   K1   K0  C2  D2"
      ]
     },
     "execution_count": 32,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "pd.merge(left, right, on=[\"key1\", \"key2\"], how=\"inner\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 33,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style>\n",
       "    .dataframe thead tr:only-child th {\n",
       "        text-align: right;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: left;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>A</th>\n",
       "      <th>B</th>\n",
       "      <th>key1</th>\n",
       "      <th>key2</th>\n",
       "      <th>C</th>\n",
       "      <th>D</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>A0</td>\n",
       "      <td>B0</td>\n",
       "      <td>K0</td>\n",
       "      <td>K0</td>\n",
       "      <td>C0</td>\n",
       "      <td>D0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>A1</td>\n",
       "      <td>B1</td>\n",
       "      <td>K0</td>\n",
       "      <td>K1</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>A2</td>\n",
       "      <td>B2</td>\n",
       "      <td>K1</td>\n",
       "      <td>K0</td>\n",
       "      <td>C1</td>\n",
       "      <td>D1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>A2</td>\n",
       "      <td>B2</td>\n",
       "      <td>K1</td>\n",
       "      <td>K0</td>\n",
       "      <td>C2</td>\n",
       "      <td>D2</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>A3</td>\n",
       "      <td>B3</td>\n",
       "      <td>K2</td>\n",
       "      <td>K1</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "    A   B key1 key2    C    D\n",
       "0  A0  B0   K0   K0   C0   D0\n",
       "1  A1  B1   K0   K1  NaN  NaN\n",
       "2  A2  B2   K1   K0   C1   D1\n",
       "3  A2  B2   K1   K0   C2   D2\n",
       "4  A3  B3   K2   K1  NaN  NaN"
      ]
     },
     "execution_count": 33,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "pd.merge(left, right, on=[\"key1\", \"key2\"], how=\"left\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 34,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style>\n",
       "    .dataframe thead tr:only-child th {\n",
       "        text-align: right;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: left;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>A</th>\n",
       "      <th>B</th>\n",
       "      <th>key1</th>\n",
       "      <th>key2</th>\n",
       "      <th>C</th>\n",
       "      <th>D</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>A0</td>\n",
       "      <td>B0</td>\n",
       "      <td>K0</td>\n",
       "      <td>K0</td>\n",
       "      <td>C0</td>\n",
       "      <td>D0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>A2</td>\n",
       "      <td>B2</td>\n",
       "      <td>K1</td>\n",
       "      <td>K0</td>\n",
       "      <td>C1</td>\n",
       "      <td>D1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>A2</td>\n",
       "      <td>B2</td>\n",
       "      <td>K1</td>\n",
       "      <td>K0</td>\n",
       "      <td>C2</td>\n",
       "      <td>D2</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>K2</td>\n",
       "      <td>K0</td>\n",
       "      <td>C3</td>\n",
       "      <td>D3</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "     A    B key1 key2   C   D\n",
       "0   A0   B0   K0   K0  C0  D0\n",
       "1   A2   B2   K1   K0  C1  D1\n",
       "2   A2   B2   K1   K0  C2  D2\n",
       "3  NaN  NaN   K2   K0  C3  D3"
      ]
     },
     "execution_count": 34,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "pd.merge(left, right, on=[\"key1\", \"key2\"], how=\"right\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 35,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style>\n",
       "    .dataframe thead tr:only-child th {\n",
       "        text-align: right;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: left;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>A</th>\n",
       "      <th>B</th>\n",
       "      <th>key1</th>\n",
       "      <th>key2</th>\n",
       "      <th>C</th>\n",
       "      <th>D</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>A0</td>\n",
       "      <td>B0</td>\n",
       "      <td>K0</td>\n",
       "      <td>K0</td>\n",
       "      <td>C0</td>\n",
       "      <td>D0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>A1</td>\n",
       "      <td>B1</td>\n",
       "      <td>K0</td>\n",
       "      <td>K1</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>A2</td>\n",
       "      <td>B2</td>\n",
       "      <td>K1</td>\n",
       "      <td>K0</td>\n",
       "      <td>C1</td>\n",
       "      <td>D1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>A2</td>\n",
       "      <td>B2</td>\n",
       "      <td>K1</td>\n",
       "      <td>K0</td>\n",
       "      <td>C2</td>\n",
       "      <td>D2</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>A3</td>\n",
       "      <td>B3</td>\n",
       "      <td>K2</td>\n",
       "      <td>K1</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>5</th>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>K2</td>\n",
       "      <td>K0</td>\n",
       "      <td>C3</td>\n",
       "      <td>D3</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "     A    B key1 key2    C    D\n",
       "0   A0   B0   K0   K0   C0   D0\n",
       "1   A1   B1   K0   K1  NaN  NaN\n",
       "2   A2   B2   K1   K0   C1   D1\n",
       "3   A2   B2   K1   K0   C2   D2\n",
       "4   A3   B3   K2   K1  NaN  NaN\n",
       "5  NaN  NaN   K2   K0   C3   D3"
      ]
     },
     "execution_count": 35,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "pd.merge(left, right, on=[\"key1\", \"key2\"], how=\"outer\")"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# 交叉表透视表"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 36,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style>\n",
       "    .dataframe thead tr:only-child th {\n",
       "        text-align: right;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: left;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>open</th>\n",
       "      <th>high</th>\n",
       "      <th>close</th>\n",
       "      <th>low</th>\n",
       "      <th>volume</th>\n",
       "      <th>price_change</th>\n",
       "      <th>p_change</th>\n",
       "      <th>ma5</th>\n",
       "      <th>ma10</th>\n",
       "      <th>ma20</th>\n",
       "      <th>v_ma5</th>\n",
       "      <th>v_ma10</th>\n",
       "      <th>v_ma20</th>\n",
       "      <th>turnover</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>2018-02-27</th>\n",
       "      <td>23.53</td>\n",
       "      <td>25.88</td>\n",
       "      <td>24.16</td>\n",
       "      <td>23.53</td>\n",
       "      <td>95578.03</td>\n",
       "      <td>0.63</td>\n",
       "      <td>2.68</td>\n",
       "      <td>22.942</td>\n",
       "      <td>22.142</td>\n",
       "      <td>22.875</td>\n",
       "      <td>53782.64</td>\n",
       "      <td>46738.65</td>\n",
       "      <td>55576.11</td>\n",
       "      <td>2.39</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2018-02-26</th>\n",
       "      <td>22.80</td>\n",
       "      <td>23.78</td>\n",
       "      <td>23.53</td>\n",
       "      <td>22.80</td>\n",
       "      <td>60985.11</td>\n",
       "      <td>0.69</td>\n",
       "      <td>3.02</td>\n",
       "      <td>22.406</td>\n",
       "      <td>21.955</td>\n",
       "      <td>22.942</td>\n",
       "      <td>40827.52</td>\n",
       "      <td>42736.34</td>\n",
       "      <td>56007.50</td>\n",
       "      <td>1.53</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2018-02-23</th>\n",
       "      <td>22.88</td>\n",
       "      <td>23.37</td>\n",
       "      <td>22.82</td>\n",
       "      <td>22.71</td>\n",
       "      <td>52914.01</td>\n",
       "      <td>0.54</td>\n",
       "      <td>2.42</td>\n",
       "      <td>21.938</td>\n",
       "      <td>21.929</td>\n",
       "      <td>23.022</td>\n",
       "      <td>35119.58</td>\n",
       "      <td>41871.97</td>\n",
       "      <td>56372.85</td>\n",
       "      <td>1.32</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2018-02-22</th>\n",
       "      <td>22.25</td>\n",
       "      <td>22.76</td>\n",
       "      <td>22.28</td>\n",
       "      <td>22.02</td>\n",
       "      <td>36105.01</td>\n",
       "      <td>0.36</td>\n",
       "      <td>1.64</td>\n",
       "      <td>21.446</td>\n",
       "      <td>21.909</td>\n",
       "      <td>23.137</td>\n",
       "      <td>35397.58</td>\n",
       "      <td>39904.78</td>\n",
       "      <td>60149.60</td>\n",
       "      <td>0.90</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2018-02-14</th>\n",
       "      <td>21.49</td>\n",
       "      <td>21.99</td>\n",
       "      <td>21.92</td>\n",
       "      <td>21.48</td>\n",
       "      <td>23331.04</td>\n",
       "      <td>0.44</td>\n",
       "      <td>2.05</td>\n",
       "      <td>21.366</td>\n",
       "      <td>21.923</td>\n",
       "      <td>23.253</td>\n",
       "      <td>33590.21</td>\n",
       "      <td>42935.74</td>\n",
       "      <td>61716.11</td>\n",
       "      <td>0.58</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "             open   high  close    low    volume  price_change  p_change  \\\n",
       "2018-02-27  23.53  25.88  24.16  23.53  95578.03          0.63      2.68   \n",
       "2018-02-26  22.80  23.78  23.53  22.80  60985.11          0.69      3.02   \n",
       "2018-02-23  22.88  23.37  22.82  22.71  52914.01          0.54      2.42   \n",
       "2018-02-22  22.25  22.76  22.28  22.02  36105.01          0.36      1.64   \n",
       "2018-02-14  21.49  21.99  21.92  21.48  23331.04          0.44      2.05   \n",
       "\n",
       "               ma5    ma10    ma20     v_ma5    v_ma10    v_ma20  turnover  \n",
       "2018-02-27  22.942  22.142  22.875  53782.64  46738.65  55576.11      2.39  \n",
       "2018-02-26  22.406  21.955  22.942  40827.52  42736.34  56007.50      1.53  \n",
       "2018-02-23  21.938  21.929  23.022  35119.58  41871.97  56372.85      1.32  \n",
       "2018-02-22  21.446  21.909  23.137  35397.58  39904.78  60149.60      0.90  \n",
       "2018-02-14  21.366  21.923  23.253  33590.21  42935.74  61716.11      0.58  "
      ]
     },
     "execution_count": 36,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "data.head()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 37,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "Index(['2018-02-27', '2018-02-26', '2018-02-23', '2018-02-22', '2018-02-14',\n",
       "       '2018-02-13', '2018-02-12', '2018-02-09', '2018-02-08', '2018-02-07',\n",
       "       ...\n",
       "       '2015-03-13', '2015-03-12', '2015-03-11', '2015-03-10', '2015-03-09',\n",
       "       '2015-03-06', '2015-03-05', '2015-03-04', '2015-03-03', '2015-03-02'],\n",
       "      dtype='object', length=643)"
      ]
     },
     "execution_count": 37,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "data.index"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 38,
   "metadata": {},
   "outputs": [],
   "source": [
    "time = pd.to_datetime(data.index)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 39,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "Int64Index([1, 0, 4, 3, 2, 1, 0, 4, 3, 2,\n",
       "            ...\n",
       "            4, 3, 2, 1, 0, 4, 3, 2, 1, 0],\n",
       "           dtype='int64', length=643)"
      ]
     },
     "execution_count": 39,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "time.weekday"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 40,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "Int64Index([27, 26, 23, 22, 14, 13, 12,  9,  8,  7,\n",
       "            ...\n",
       "            13, 12, 11, 10,  9,  6,  5,  4,  3,  2],\n",
       "           dtype='int64', length=643)"
      ]
     },
     "execution_count": 40,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "time.day"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 41,
   "metadata": {},
   "outputs": [],
   "source": [
    "data[\"week\"] = time.weekday"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 42,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style>\n",
       "    .dataframe thead tr:only-child th {\n",
       "        text-align: right;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: left;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>open</th>\n",
       "      <th>high</th>\n",
       "      <th>close</th>\n",
       "      <th>low</th>\n",
       "      <th>volume</th>\n",
       "      <th>price_change</th>\n",
       "      <th>p_change</th>\n",
       "      <th>ma5</th>\n",
       "      <th>ma10</th>\n",
       "      <th>ma20</th>\n",
       "      <th>v_ma5</th>\n",
       "      <th>v_ma10</th>\n",
       "      <th>v_ma20</th>\n",
       "      <th>turnover</th>\n",
       "      <th>week</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>2018-02-27</th>\n",
       "      <td>23.53</td>\n",
       "      <td>25.88</td>\n",
       "      <td>24.16</td>\n",
       "      <td>23.53</td>\n",
       "      <td>95578.03</td>\n",
       "      <td>0.63</td>\n",
       "      <td>2.68</td>\n",
       "      <td>22.942</td>\n",
       "      <td>22.142</td>\n",
       "      <td>22.875</td>\n",
       "      <td>53782.64</td>\n",
       "      <td>46738.65</td>\n",
       "      <td>55576.11</td>\n",
       "      <td>2.39</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2018-02-26</th>\n",
       "      <td>22.80</td>\n",
       "      <td>23.78</td>\n",
       "      <td>23.53</td>\n",
       "      <td>22.80</td>\n",
       "      <td>60985.11</td>\n",
       "      <td>0.69</td>\n",
       "      <td>3.02</td>\n",
       "      <td>22.406</td>\n",
       "      <td>21.955</td>\n",
       "      <td>22.942</td>\n",
       "      <td>40827.52</td>\n",
       "      <td>42736.34</td>\n",
       "      <td>56007.50</td>\n",
       "      <td>1.53</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2018-02-23</th>\n",
       "      <td>22.88</td>\n",
       "      <td>23.37</td>\n",
       "      <td>22.82</td>\n",
       "      <td>22.71</td>\n",
       "      <td>52914.01</td>\n",
       "      <td>0.54</td>\n",
       "      <td>2.42</td>\n",
       "      <td>21.938</td>\n",
       "      <td>21.929</td>\n",
       "      <td>23.022</td>\n",
       "      <td>35119.58</td>\n",
       "      <td>41871.97</td>\n",
       "      <td>56372.85</td>\n",
       "      <td>1.32</td>\n",
       "      <td>4</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2018-02-22</th>\n",
       "      <td>22.25</td>\n",
       "      <td>22.76</td>\n",
       "      <td>22.28</td>\n",
       "      <td>22.02</td>\n",
       "      <td>36105.01</td>\n",
       "      <td>0.36</td>\n",
       "      <td>1.64</td>\n",
       "      <td>21.446</td>\n",
       "      <td>21.909</td>\n",
       "      <td>23.137</td>\n",
       "      <td>35397.58</td>\n",
       "      <td>39904.78</td>\n",
       "      <td>60149.60</td>\n",
       "      <td>0.90</td>\n",
       "      <td>3</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2018-02-14</th>\n",
       "      <td>21.49</td>\n",
       "      <td>21.99</td>\n",
       "      <td>21.92</td>\n",
       "      <td>21.48</td>\n",
       "      <td>23331.04</td>\n",
       "      <td>0.44</td>\n",
       "      <td>2.05</td>\n",
       "      <td>21.366</td>\n",
       "      <td>21.923</td>\n",
       "      <td>23.253</td>\n",
       "      <td>33590.21</td>\n",
       "      <td>42935.74</td>\n",
       "      <td>61716.11</td>\n",
       "      <td>0.58</td>\n",
       "      <td>2</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "             open   high  close    low    volume  price_change  p_change  \\\n",
       "2018-02-27  23.53  25.88  24.16  23.53  95578.03          0.63      2.68   \n",
       "2018-02-26  22.80  23.78  23.53  22.80  60985.11          0.69      3.02   \n",
       "2018-02-23  22.88  23.37  22.82  22.71  52914.01          0.54      2.42   \n",
       "2018-02-22  22.25  22.76  22.28  22.02  36105.01          0.36      1.64   \n",
       "2018-02-14  21.49  21.99  21.92  21.48  23331.04          0.44      2.05   \n",
       "\n",
       "               ma5    ma10    ma20     v_ma5    v_ma10    v_ma20  turnover  \\\n",
       "2018-02-27  22.942  22.142  22.875  53782.64  46738.65  55576.11      2.39   \n",
       "2018-02-26  22.406  21.955  22.942  40827.52  42736.34  56007.50      1.53   \n",
       "2018-02-23  21.938  21.929  23.022  35119.58  41871.97  56372.85      1.32   \n",
       "2018-02-22  21.446  21.909  23.137  35397.58  39904.78  60149.60      0.90   \n",
       "2018-02-14  21.366  21.923  23.253  33590.21  42935.74  61716.11      0.58   \n",
       "\n",
       "            week  \n",
       "2018-02-27     1  \n",
       "2018-02-26     0  \n",
       "2018-02-23     4  \n",
       "2018-02-22     3  \n",
       "2018-02-14     2  "
      ]
     },
     "execution_count": 42,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "data.head()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 43,
   "metadata": {},
   "outputs": [],
   "source": [
    "data[\"p_n\"] = np.where(data[\"p_change\"] > 0, 1, 0)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 44,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style>\n",
       "    .dataframe thead tr:only-child th {\n",
       "        text-align: right;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: left;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>open</th>\n",
       "      <th>high</th>\n",
       "      <th>close</th>\n",
       "      <th>low</th>\n",
       "      <th>volume</th>\n",
       "      <th>price_change</th>\n",
       "      <th>p_change</th>\n",
       "      <th>ma5</th>\n",
       "      <th>ma10</th>\n",
       "      <th>ma20</th>\n",
       "      <th>v_ma5</th>\n",
       "      <th>v_ma10</th>\n",
       "      <th>v_ma20</th>\n",
       "      <th>turnover</th>\n",
       "      <th>week</th>\n",
       "      <th>p_n</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>2018-02-27</th>\n",
       "      <td>23.53</td>\n",
       "      <td>25.88</td>\n",
       "      <td>24.16</td>\n",
       "      <td>23.53</td>\n",
       "      <td>95578.03</td>\n",
       "      <td>0.63</td>\n",
       "      <td>2.68</td>\n",
       "      <td>22.942</td>\n",
       "      <td>22.142</td>\n",
       "      <td>22.875</td>\n",
       "      <td>53782.64</td>\n",
       "      <td>46738.65</td>\n",
       "      <td>55576.11</td>\n",
       "      <td>2.39</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2018-02-26</th>\n",
       "      <td>22.80</td>\n",
       "      <td>23.78</td>\n",
       "      <td>23.53</td>\n",
       "      <td>22.80</td>\n",
       "      <td>60985.11</td>\n",
       "      <td>0.69</td>\n",
       "      <td>3.02</td>\n",
       "      <td>22.406</td>\n",
       "      <td>21.955</td>\n",
       "      <td>22.942</td>\n",
       "      <td>40827.52</td>\n",
       "      <td>42736.34</td>\n",
       "      <td>56007.50</td>\n",
       "      <td>1.53</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2018-02-23</th>\n",
       "      <td>22.88</td>\n",
       "      <td>23.37</td>\n",
       "      <td>22.82</td>\n",
       "      <td>22.71</td>\n",
       "      <td>52914.01</td>\n",
       "      <td>0.54</td>\n",
       "      <td>2.42</td>\n",
       "      <td>21.938</td>\n",
       "      <td>21.929</td>\n",
       "      <td>23.022</td>\n",
       "      <td>35119.58</td>\n",
       "      <td>41871.97</td>\n",
       "      <td>56372.85</td>\n",
       "      <td>1.32</td>\n",
       "      <td>4</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2018-02-22</th>\n",
       "      <td>22.25</td>\n",
       "      <td>22.76</td>\n",
       "      <td>22.28</td>\n",
       "      <td>22.02</td>\n",
       "      <td>36105.01</td>\n",
       "      <td>0.36</td>\n",
       "      <td>1.64</td>\n",
       "      <td>21.446</td>\n",
       "      <td>21.909</td>\n",
       "      <td>23.137</td>\n",
       "      <td>35397.58</td>\n",
       "      <td>39904.78</td>\n",
       "      <td>60149.60</td>\n",
       "      <td>0.90</td>\n",
       "      <td>3</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2018-02-14</th>\n",
       "      <td>21.49</td>\n",
       "      <td>21.99</td>\n",
       "      <td>21.92</td>\n",
       "      <td>21.48</td>\n",
       "      <td>23331.04</td>\n",
       "      <td>0.44</td>\n",
       "      <td>2.05</td>\n",
       "      <td>21.366</td>\n",
       "      <td>21.923</td>\n",
       "      <td>23.253</td>\n",
       "      <td>33590.21</td>\n",
       "      <td>42935.74</td>\n",
       "      <td>61716.11</td>\n",
       "      <td>0.58</td>\n",
       "      <td>2</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "             open   high  close    low    volume  price_change  p_change  \\\n",
       "2018-02-27  23.53  25.88  24.16  23.53  95578.03          0.63      2.68   \n",
       "2018-02-26  22.80  23.78  23.53  22.80  60985.11          0.69      3.02   \n",
       "2018-02-23  22.88  23.37  22.82  22.71  52914.01          0.54      2.42   \n",
       "2018-02-22  22.25  22.76  22.28  22.02  36105.01          0.36      1.64   \n",
       "2018-02-14  21.49  21.99  21.92  21.48  23331.04          0.44      2.05   \n",
       "\n",
       "               ma5    ma10    ma20     v_ma5    v_ma10    v_ma20  turnover  \\\n",
       "2018-02-27  22.942  22.142  22.875  53782.64  46738.65  55576.11      2.39   \n",
       "2018-02-26  22.406  21.955  22.942  40827.52  42736.34  56007.50      1.53   \n",
       "2018-02-23  21.938  21.929  23.022  35119.58  41871.97  56372.85      1.32   \n",
       "2018-02-22  21.446  21.909  23.137  35397.58  39904.78  60149.60      0.90   \n",
       "2018-02-14  21.366  21.923  23.253  33590.21  42935.74  61716.11      0.58   \n",
       "\n",
       "            week  p_n  \n",
       "2018-02-27     1    1  \n",
       "2018-02-26     0    1  \n",
       "2018-02-23     4    1  \n",
       "2018-02-22     3    1  \n",
       "2018-02-14     2    1  "
      ]
     },
     "execution_count": 44,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "data.head()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 45,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style>\n",
       "    .dataframe thead tr:only-child th {\n",
       "        text-align: right;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: left;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th>p_n</th>\n",
       "      <th>0</th>\n",
       "      <th>1</th>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>week</th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>63</td>\n",
       "      <td>62</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>55</td>\n",
       "      <td>76</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>61</td>\n",
       "      <td>71</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>63</td>\n",
       "      <td>65</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>59</td>\n",
       "      <td>68</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "p_n    0   1\n",
       "week        \n",
       "0     63  62\n",
       "1     55  76\n",
       "2     61  71\n",
       "3     63  65\n",
       "4     59  68"
      ]
     },
     "execution_count": 45,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "count = pd.crosstab(data[\"week\"], data[\"p_n\"])\n",
    "count"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 46,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "week\n",
       "0    125.0\n",
       "1    131.0\n",
       "2    132.0\n",
       "3    128.0\n",
       "4    127.0\n",
       "dtype: float32"
      ]
     },
     "execution_count": 46,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "sum = count.sum(axis=1).astype(np.float32)\n",
    "sum"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 47,
   "metadata": {},
   "outputs": [],
   "source": [
    "ret = count.div(sum, axis=0)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 48,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style>\n",
       "    .dataframe thead tr:only-child th {\n",
       "        text-align: right;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: left;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th>p_n</th>\n",
       "      <th>0</th>\n",
       "      <th>1</th>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>week</th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>0.504000</td>\n",
       "      <td>0.496000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>0.419847</td>\n",
       "      <td>0.580153</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>0.462121</td>\n",
       "      <td>0.537879</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>0.492188</td>\n",
       "      <td>0.507812</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>0.464567</td>\n",
       "      <td>0.535433</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "p_n          0         1\n",
       "week                    \n",
       "0     0.504000  0.496000\n",
       "1     0.419847  0.580153\n",
       "2     0.462121  0.537879\n",
       "3     0.492188  0.507812\n",
       "4     0.464567  0.535433"
      ]
     },
     "execution_count": 48,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "ret"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 49,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAXYAAAEDCAYAAAAhsS8XAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uIDIuMi4yLCBodHRwOi8vbWF0cGxvdGxpYi5vcmcvhp/UCwAADyBJREFUeJzt3X2QXfVZwPHvUxLYILBNNisviXRpO0VlJtva7VDeCtmQiDYgjGNVCAWZcW0dR8c2xeI/MuPoiMZWHKE1dbSdEIoMxRYzRYhJmAqFthskaeVNUijuYGtecFMsG2Ln8Y976ZLrJvfuzc09ye9+PzNMzr3727MPZ5JvTs7eczcyE0lSOd5U9QCSpM4y7JJUGMMuSYUx7JJUGMMuSYUx7JJUGMMuSYUx7JJUGMMuSYWZU8UXXbhwYQ4NDVXxpSXpmLV169ZdmTnYbF0lYR8aGmJ8fLyKLy1Jx6yI+E4r67wUI0mFMeySVBjDLkmFqeQauyRVaf/+/UxMTDA1NVX1KDPq6+tj8eLFzJ07t63PN+ySes7ExAQnn3wyQ0NDRETV4xwgM9m9ezcTExOcddZZbe3DSzGSes7U1BQDAwNHXdQBIoKBgYHD+tdES2GPiLkR8Y+H+HhfRGyIiG0RsS6OxqMlSW9wNGfqcGdrGvaImAdsBZYfYtkqYCIzh4H5TdZKko6gpmHPzFczcwkwcYhlo8DG+vZmYGkHZpMktaFT3zwdACbr23uBsxsXRMQYMAZw5plnHv5XvLn/8Pdx2DNMNl/TDR6LaR6LaR6LaY3H4mfvhpe6/IqYM97VtS/VqW+e7gJeP3L99ccHyMy1mTmSmSODg03f6kCS1KZOnbFvAlYAX6B2WeaTHdqvJB0Vbv7zT/P1J/6Nyb2vsOi0H+fzt/8xxx133AFrPvv39/HN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jPR8RXqYX7ReBPgI9FxGPU/hL4bv1zp4C7gWURcXrXJ5dmwTtPJakwnrFLUmEMuyQVxrBLUmEMuyQVxrBLUmEMuyQVxrBLUmH+D7J0Ta72OYyhAAAAAElFTkSuQmCC\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "ret.plot(kind=\"bar\", stacked=True)\n",
    "plt.show()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 50,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style>\n",
       "    .dataframe thead tr:only-child th {\n",
       "        text-align: right;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: left;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>p_n</th>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>week</th>\n",
       "      <th></th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>0.496000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>0.580153</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>0.537879</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>0.507812</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>0.535433</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "           p_n\n",
       "week          \n",
       "0     0.496000\n",
       "1     0.580153\n",
       "2     0.537879\n",
       "3     0.507812\n",
       "4     0.535433"
      ]
     },
     "execution_count": 50,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "data.pivot_table([\"p_n\"], index=\"week\")"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# 分组聚合"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 51,
   "metadata": {},
   "outputs": [],
   "source": [
    "col =pd.DataFrame({'color': ['white','red','green','red','green'], 'object': ['pen','pencil','pencil','ashtray','pen'],'price1':[5.56,4.20,1.30,0.56,2.75],'price2':[4.75,4.12,1.60,0.75,3.15]})\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 52,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style>\n",
       "    .dataframe thead tr:only-child th {\n",
       "        text-align: right;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: left;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>color</th>\n",
       "      <th>object</th>\n",
       "      <th>price1</th>\n",
       "      <th>price2</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>white</td>\n",
       "      <td>pen</td>\n",
       "      <td>5.56</td>\n",
       "      <td>4.75</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>red</td>\n",
       "      <td>pencil</td>\n",
       "      <td>4.20</td>\n",
       "      <td>4.12</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>green</td>\n",
       "      <td>pencil</td>\n",
       "      <td>1.30</td>\n",
       "      <td>1.60</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>red</td>\n",
       "      <td>ashtray</td>\n",
       "      <td>0.56</td>\n",
       "      <td>0.75</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>green</td>\n",
       "      <td>pen</td>\n",
       "      <td>2.75</td>\n",
       "      <td>3.15</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "   color   object  price1  price2\n",
       "0  white      pen    5.56    4.75\n",
       "1    red   pencil    4.20    4.12\n",
       "2  green   pencil    1.30    1.60\n",
       "3    red  ashtray    0.56    0.75\n",
       "4  green      pen    2.75    3.15"
      ]
     },
     "execution_count": 52,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "col"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 53,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "color\n",
       "green    2.025\n",
       "red      2.380\n",
       "white    5.560\n",
       "Name: price1, dtype: float64"
      ]
     },
     "execution_count": 53,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "col.groupby([\"color\"])[\"price1\"].mean()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 54,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "color\n",
       "green    2.025\n",
       "red      2.380\n",
       "white    5.560\n",
       "Name: price1, dtype: float64"
      ]
     },
     "execution_count": 54,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "col[\"price1\"].groupby(col[\"color\"]).mean()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 55,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style>\n",
       "    .dataframe thead tr:only-child th {\n",
       "        text-align: right;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: left;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>color</th>\n",
       "      <th>price1</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>green</td>\n",
       "      <td>2.025</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>red</td>\n",
       "      <td>2.380</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>white</td>\n",
       "      <td>5.560</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "   color  price1\n",
       "0  green   2.025\n",
       "1    red   2.380\n",
       "2  white   5.560"
      ]
     },
     "execution_count": 55,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "col.groupby([\"color\"], as_index=False)[\"price1\"].mean()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 56,
   "metadata": {},
   "outputs": [],
   "source": [
    "starbucks = pd.read_csv(\"./data/starbucks/directory.csv\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 57,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style>\n",
       "    .dataframe thead tr:only-child th {\n",
       "        text-align: right;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: left;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>Brand</th>\n",
       "      <th>Store Number</th>\n",
       "      <th>Store Name</th>\n",
       "      <th>Ownership Type</th>\n",
       "      <th>Street Address</th>\n",
       "      <th>City</th>\n",
       "      <th>State/Province</th>\n",
       "      <th>Country</th>\n",
       "      <th>Postcode</th>\n",
       "      <th>Phone Number</th>\n",
       "      <th>Timezone</th>\n",
       "      <th>Longitude</th>\n",
       "      <th>Latitude</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>Starbucks</td>\n",
       "      <td>47370-257954</td>\n",
       "      <td>Meritxell, 96</td>\n",
       "      <td>Licensed</td>\n",
       "      <td>Av. Meritxell, 96</td>\n",
       "      <td>Andorra la Vella</td>\n",
       "      <td>7</td>\n",
       "      <td>AD</td>\n",
       "      <td>AD500</td>\n",
       "      <td>376818720</td>\n",
       "      <td>GMT+1:00 Europe/Andorra</td>\n",
       "      <td>1.53</td>\n",
       "      <td>42.51</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>Starbucks</td>\n",
       "      <td>22331-212325</td>\n",
       "      <td>Ajman Drive Thru</td>\n",
       "      <td>Licensed</td>\n",
       "      <td>1 Street 69, Al Jarf</td>\n",
       "      <td>Ajman</td>\n",
       "      <td>AJ</td>\n",
       "      <td>AE</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>GMT+04:00 Asia/Dubai</td>\n",
       "      <td>55.47</td>\n",
       "      <td>25.42</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>Starbucks</td>\n",
       "      <td>47089-256771</td>\n",
       "      <td>Dana Mall</td>\n",
       "      <td>Licensed</td>\n",
       "      <td>Sheikh Khalifa Bin Zayed St.</td>\n",
       "      <td>Ajman</td>\n",
       "      <td>AJ</td>\n",
       "      <td>AE</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>GMT+04:00 Asia/Dubai</td>\n",
       "      <td>55.47</td>\n",
       "      <td>25.39</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>Starbucks</td>\n",
       "      <td>22126-218024</td>\n",
       "      <td>Twofour 54</td>\n",
       "      <td>Licensed</td>\n",
       "      <td>Al Salam Street</td>\n",
       "      <td>Abu Dhabi</td>\n",
       "      <td>AZ</td>\n",
       "      <td>AE</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>GMT+04:00 Asia/Dubai</td>\n",
       "      <td>54.38</td>\n",
       "      <td>24.48</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>Starbucks</td>\n",
       "      <td>17127-178586</td>\n",
       "      <td>Al Ain Tower</td>\n",
       "      <td>Licensed</td>\n",
       "      <td>Khaldiya Area, Abu Dhabi Island</td>\n",
       "      <td>Abu Dhabi</td>\n",
       "      <td>AZ</td>\n",
       "      <td>AE</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>GMT+04:00 Asia/Dubai</td>\n",
       "      <td>54.54</td>\n",
       "      <td>24.51</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "       Brand  Store Number        Store Name Ownership Type  \\\n",
       "0  Starbucks  47370-257954     Meritxell, 96       Licensed   \n",
       "1  Starbucks  22331-212325  Ajman Drive Thru       Licensed   \n",
       "2  Starbucks  47089-256771         Dana Mall       Licensed   \n",
       "3  Starbucks  22126-218024        Twofour 54       Licensed   \n",
       "4  Starbucks  17127-178586      Al Ain Tower       Licensed   \n",
       "\n",
       "                    Street Address              City State/Province Country  \\\n",
       "0                Av. Meritxell, 96  Andorra la Vella              7      AD   \n",
       "1             1 Street 69, Al Jarf             Ajman             AJ      AE   \n",
       "2     Sheikh Khalifa Bin Zayed St.             Ajman             AJ      AE   \n",
       "3                  Al Salam Street         Abu Dhabi             AZ      AE   \n",
       "4  Khaldiya Area, Abu Dhabi Island         Abu Dhabi             AZ      AE   \n",
       "\n",
       "  Postcode Phone Number                 Timezone  Longitude  Latitude  \n",
       "0    AD500    376818720  GMT+1:00 Europe/Andorra       1.53     42.51  \n",
       "1      NaN          NaN     GMT+04:00 Asia/Dubai      55.47     25.42  \n",
       "2      NaN          NaN     GMT+04:00 Asia/Dubai      55.47     25.39  \n",
       "3      NaN          NaN     GMT+04:00 Asia/Dubai      54.38     24.48  \n",
       "4      NaN          NaN     GMT+04:00 Asia/Dubai      54.54     24.51  "
      ]
     },
     "execution_count": 57,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "starbucks.head()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 58,
   "metadata": {},
   "outputs": [],
   "source": [
    "count = starbucks.groupby([\"Country\"]).count()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 59,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAABI0AAAHhCAYAAADjxk6yAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uIDIuMi4yLCBodHRwOi8vbWF0cGxvdGxpYi5vcmcvhp/UCwAAIABJREFUeJzt3XmYZVdZL/7vGwIGiIQMLVGuGhkighKVgArEkABhSBy4KiKCgF7jFQdARcHhRxzAoDiABCV6BcUwKOgViAghBGSGztWEK4hEjT6gYEeUoHABYf3+WLtMda3uPrvO6e6qSn8+z1NP7drnvGfvfc4ev2ftVdVaCwAAAACsd9RWzwAAAAAA24/QCAAAAICB0AgAAACAgdAIAAAAgIHQCAAAAICB0AgAAACAgdAIAAAAgIHQCAAAAICB0AgAAACAwdFbPQMHctJJJ7VTTjllq2cDAAAA4EbjyiuvvK61tmvR87Z1aHTKKadk9+7dWz0bAAAAADcaVfX3c57n9jQAAAAABkIjAAAAAAZCIwAAAAAGQiMAAAAABrNCo6q6aVW9YsO4J1TVa6fhk6rqjVX1rqq6cDPjAAAAANh+FoZGVXXzJFcmuf+6cV+Y5NHrnvb4JJcmOS3Jg6rq1E2MAwAAAGCbWRgatdY+3lq7a5L3rxv9zCRPXvf32Ukua619Jskbkpy1i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OASGgEAJG9Ov0Ut6S2HnpTev1Gm33+Z5JOZgqUkD1pX++/7eL2PJ7llklRVrY1srW187u8muTjJS1eYdwCAQ0JoBADQbxW7pqrekeTeSZ6f5C5V9eYkp05/X57koVV1UZKbHOjFWmsfSvIfVfWmJI87wPPePA2+eNUFAAA42GpqIQ0AwGFUVTdP8vokb2qt/fAWzw4AwEBoBAAAAMDA7WkAAAAADIRGAAAAAAyERgAAAAAMhEYAAAAADIRGAAAAAAz+f9qY6ZtvlK/LAAAAAElFTkSuQmCC\n",
      "text/plain": [
       "<Figure size 1440x576 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "count[\"Brand\"].plot(kind=\"bar\", figsize=(20, 8))\n",
    "plt.show()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 60,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style>\n",
       "    .dataframe thead tr:only-child th {\n",
       "        text-align: right;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: left;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th>Brand</th>\n",
       "      <th>Store Number</th>\n",
       "      <th>Store Name</th>\n",
       "      <th>Ownership Type</th>\n",
       "      <th>Street Address</th>\n",
       "      <th>City</th>\n",
       "      <th>Postcode</th>\n",
       "      <th>Phone Number</th>\n",
       "      <th>Timezone</th>\n",
       "      <th>Longitude</th>\n",
       "      <th>Latitude</th>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>Country</th>\n",
       "      <th>State/Province</th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>AD</th>\n",
       "      <th>7</th>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th rowspan=\"7\" valign=\"top\">AE</th>\n",
       "      <th>AJ</th>\n",
       "      <td>2</td>\n",
       "      <td>2</td>\n",
       "      <td>2</td>\n",
       "      <td>2</td>\n",
       "      <td>2</td>\n",
       "      <td>2</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>2</td>\n",
       "      <td>2</td>\n",
       "      <td>2</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>AZ</th>\n",
       "      <td>48</td>\n",
       "      <td>48</td>\n",
       "      <td>48</td>\n",
       "      <td>48</td>\n",
       "      <td>48</td>\n",
       "      <td>48</td>\n",
       "      <td>7</td>\n",
       "      <td>20</td>\n",
       "      <td>48</td>\n",
       "      <td>48</td>\n",
       "      <td>48</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>DU</th>\n",
       "      <td>82</td>\n",
       "      <td>82</td>\n",
       "      <td>82</td>\n",
       "      <td>82</td>\n",
       "      <td>82</td>\n",
       "      <td>82</td>\n",
       "      <td>16</td>\n",
       "      <td>50</td>\n",
       "      <td>82</td>\n",
       "      <td>82</td>\n",
       "      <td>82</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>FU</th>\n",
       "      <td>2</td>\n",
       "      <td>2</td>\n",
       "      <td>2</td>\n",
       "      <td>2</td>\n",
       "      <td>2</td>\n",
       "      <td>2</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>2</td>\n",
       "      <td>2</td>\n",
       "      <td>2</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>RK</th>\n",
       "      <td>3</td>\n",
       "      <td>3</td>\n",
       "      <td>3</td>\n",
       "      <td>3</td>\n",
       "      <td>3</td>\n",
       "      <td>3</td>\n",
       "      <td>0</td>\n",
       "      <td>3</td>\n",
       "      <td>3</td>\n",
       "      <td>3</td>\n",
       "      <td>3</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>SH</th>\n",
       "      <td>6</td>\n",
       "      <td>6</td>\n",
       "      <td>6</td>\n",
       "      <td>6</td>\n",
       "      <td>6</td>\n",
       "      <td>6</td>\n",
       "      <td>0</td>\n",
       "      <td>5</td>\n",
       "      <td>6</td>\n",
       "      <td>6</td>\n",
       "      <td>6</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>UQ</th>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th rowspan=\"5\" valign=\"top\">AR</th>\n",
       "      <th>B</th>\n",
       "      <td>21</td>\n",
       "      <td>21</td>\n",
       "      <td>21</td>\n",
       "      <td>21</td>\n",
       "      <td>21</td>\n",
       "      <td>21</td>\n",
       "      <td>18</td>\n",
       "      <td>5</td>\n",
       "      <td>21</td>\n",
       "      <td>21</td>\n",
       "      <td>21</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>C</th>\n",
       "      <td>73</td>\n",
       "      <td>73</td>\n",
       "      <td>73</td>\n",
       "      <td>73</td>\n",
       "      <td>73</td>\n",
       "      <td>73</td>\n",
       "      <td>71</td>\n",
       "      <td>24</td>\n",
       "      <td>73</td>\n",
       "      <td>73</td>\n",
       "      <td>73</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>M</th>\n",
       "      <td>5</td>\n",
       "      <td>5</td>\n",
       "      <td>5</td>\n",
       "      <td>5</td>\n",
       "      <td>5</td>\n",
       "      <td>5</td>\n",
       "      <td>2</td>\n",
       "      <td>0</td>\n",
       "      <td>5</td>\n",
       "      <td>5</td>\n",
       "      <td>5</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>S</th>\n",
       "      <td>3</td>\n",
       "      <td>3</td>\n",
       "      <td>3</td>\n",
       "      <td>3</td>\n",
       "      <td>3</td>\n",
       "      <td>3</td>\n",
       "      <td>3</td>\n",
       "      <td>0</td>\n",
       "      <td>3</td>\n",
       "      <td>3</td>\n",
       "      <td>3</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>X</th>\n",
       "      <td>6</td>\n",
       "      <td>6</td>\n",
       "      <td>6</td>\n",
       "      <td>6</td>\n",
       "      <td>6</td>\n",
       "      <td>6</td>\n",
       "      <td>6</td>\n",
       "      <td>0</td>\n",
       "      <td>6</td>\n",
       "      <td>6</td>\n",
       "      <td>6</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th rowspan=\"3\" valign=\"top\">AT</th>\n",
       "      <th>3</th>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>5</th>\n",
       "      <td>3</td>\n",
       "      <td>3</td>\n",
       "      <td>3</td>\n",
       "      <td>3</td>\n",
       "      <td>3</td>\n",
       "      <td>3</td>\n",
       "      <td>3</td>\n",
       "      <td>3</td>\n",
       "      <td>3</td>\n",
       "      <td>3</td>\n",
       "      <td>3</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>9</th>\n",
       "      <td>14</td>\n",
       "      <td>14</td>\n",
       "      <td>14</td>\n",
       "      <td>14</td>\n",
       "      <td>14</td>\n",
       "      <td>14</td>\n",
       "      <td>14</td>\n",
       "      <td>13</td>\n",
       "      <td>14</td>\n",
       "      <td>14</td>\n",
       "      <td>14</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th rowspan=\"3\" valign=\"top\">AU</th>\n",
       "      <th>NSW</th>\n",
       "      <td>9</td>\n",
       "      <td>9</td>\n",
       "      <td>9</td>\n",
       "      <td>9</td>\n",
       "      <td>9</td>\n",
       "      <td>9</td>\n",
       "      <td>9</td>\n",
       "      <td>0</td>\n",
       "      <td>9</td>\n",
       "      <td>9</td>\n",
       "      <td>9</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>QLD</th>\n",
       "      <td>8</td>\n",
       "      <td>8</td>\n",
       "      <td>8</td>\n",
       "      <td>8</td>\n",
       "      <td>8</td>\n",
       "      <td>8</td>\n",
       "      <td>8</td>\n",
       "      <td>0</td>\n",
       "      <td>8</td>\n",
       "      <td>8</td>\n",
       "      <td>8</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>VIC</th>\n",
       "      <td>5</td>\n",
       "      <td>5</td>\n",
       "      <td>5</td>\n",
       "      <td>5</td>\n",
       "      <td>5</td>\n",
       "      <td>5</td>\n",
       "      <td>5</td>\n",
       "      <td>0</td>\n",
       "      <td>5</td>\n",
       "      <td>5</td>\n",
       "      <td>5</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>AW</th>\n",
       "      <th>AW</th>\n",
       "      <td>3</td>\n",
       "      <td>3</td>\n",
       "      <td>3</td>\n",
       "      <td>3</td>\n",
       "      <td>3</td>\n",
       "      <td>3</td>\n",
       "      <td>0</td>\n",
       "      <td>3</td>\n",
       "      <td>3</td>\n",
       "      <td>3</td>\n",
       "      <td>3</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th rowspan=\"2\" valign=\"top\">AZ</th>\n",
       "      <th>BA</th>\n",
       "      <td>3</td>\n",
       "      <td>3</td>\n",
       "      <td>3</td>\n",
       "      <td>3</td>\n",
       "      <td>3</td>\n",
       "      <td>3</td>\n",
       "      <td>2</td>\n",
       "      <td>3</td>\n",
       "      <td>3</td>\n",
       "      <td>3</td>\n",
       "      <td>3</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>SAB</th>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th rowspan=\"5\" valign=\"top\">BE</th>\n",
       "      <th>BE</th>\n",
       "      <td>4</td>\n",
       "      <td>4</td>\n",
       "      <td>4</td>\n",
       "      <td>4</td>\n",
       "      <td>4</td>\n",
       "      <td>4</td>\n",
       "      <td>4</td>\n",
       "      <td>0</td>\n",
       "      <td>4</td>\n",
       "      <td>4</td>\n",
       "      <td>4</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>VAN</th>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>VBR</th>\n",
       "      <td>2</td>\n",
       "      <td>2</td>\n",
       "      <td>2</td>\n",
       "      <td>2</td>\n",
       "      <td>2</td>\n",
       "      <td>2</td>\n",
       "      <td>2</td>\n",
       "      <td>0</td>\n",
       "      <td>2</td>\n",
       "      <td>2</td>\n",
       "      <td>2</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>VLG</th>\n",
       "      <td>10</td>\n",
       "      <td>10</td>\n",
       "      <td>10</td>\n",
       "      <td>10</td>\n",
       "      <td>10</td>\n",
       "      <td>10</td>\n",
       "      <td>10</td>\n",
       "      <td>1</td>\n",
       "      <td>10</td>\n",
       "      <td>10</td>\n",
       "      <td>10</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>WAL</th>\n",
       "      <td>2</td>\n",
       "      <td>2</td>\n",
       "      <td>2</td>\n",
       "      <td>2</td>\n",
       "      <td>2</td>\n",
       "      <td>2</td>\n",
       "      <td>2</td>\n",
       "      <td>0</td>\n",
       "      <td>2</td>\n",
       "      <td>2</td>\n",
       "      <td>2</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th rowspan=\"2\" valign=\"top\">BG</th>\n",
       "      <th>2</th>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>23</th>\n",
       "      <td>4</td>\n",
       "      <td>4</td>\n",
       "      <td>4</td>\n",
       "      <td>4</td>\n",
       "      <td>4</td>\n",
       "      <td>4</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>4</td>\n",
       "      <td>4</td>\n",
       "      <td>4</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>BH</th>\n",
       "      <th>13</th>\n",
       "      <td>16</td>\n",
       "      <td>16</td>\n",
       "      <td>16</td>\n",
       "      <td>16</td>\n",
       "      <td>16</td>\n",
       "      <td>16</td>\n",
       "      <td>2</td>\n",
       "      <td>10</td>\n",
       "      <td>16</td>\n",
       "      <td>16</td>\n",
       "      <td>16</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th rowspan=\"27\" valign=\"top\">US</th>\n",
       "      <th>MO</th>\n",
       "      <td>188</td>\n",
       "      <td>188</td>\n",
       "      <td>188</td>\n",
       "      <td>188</td>\n",
       "      <td>188</td>\n",
       "      <td>188</td>\n",
       "      <td>188</td>\n",
       "      <td>175</td>\n",
       "      <td>188</td>\n",
       "      <td>188</td>\n",
       "      <td>188</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>MS</th>\n",
       "      <td>32</td>\n",
       "      <td>32</td>\n",
       "      <td>32</td>\n",
       "      <td>32</td>\n",
       "      <td>32</td>\n",
       "      <td>32</td>\n",
       "      <td>32</td>\n",
       "      <td>28</td>\n",
       "      <td>32</td>\n",
       "      <td>32</td>\n",
       "      <td>32</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>MT</th>\n",
       "      <td>36</td>\n",
       "      <td>36</td>\n",
       "      <td>36</td>\n",
       "      <td>36</td>\n",
       "      <td>36</td>\n",
       "      <td>36</td>\n",
       "      <td>36</td>\n",
       "      <td>36</td>\n",
       "      <td>36</td>\n",
       "      <td>36</td>\n",
       "      <td>36</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>NC</th>\n",
       "      <td>338</td>\n",
       "      <td>338</td>\n",
       "      <td>338</td>\n",
       "      <td>338</td>\n",
       "      <td>338</td>\n",
       "      <td>338</td>\n",
       "      <td>338</td>\n",
       "      <td>322</td>\n",
       "      <td>338</td>\n",
       "      <td>338</td>\n",
       "      <td>338</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>ND</th>\n",
       "      <td>13</td>\n",
       "      <td>13</td>\n",
       "      <td>13</td>\n",
       "      <td>13</td>\n",
       "      <td>13</td>\n",
       "      <td>13</td>\n",
       "      <td>13</td>\n",
       "      <td>13</td>\n",
       "      <td>13</td>\n",
       "      <td>13</td>\n",
       "      <td>13</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>NE</th>\n",
       "      <td>58</td>\n",
       "      <td>58</td>\n",
       "      <td>58</td>\n",
       "      <td>58</td>\n",
       "      <td>58</td>\n",
       "      <td>58</td>\n",
       "      <td>58</td>\n",
       "      <td>56</td>\n",
       "      <td>58</td>\n",
       "      <td>58</td>\n",
       "      <td>58</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>NH</th>\n",
       "      <td>29</td>\n",
       "      <td>29</td>\n",
       "      <td>29</td>\n",
       "      <td>29</td>\n",
       "      <td>29</td>\n",
       "      <td>29</td>\n",
       "      <td>29</td>\n",
       "      <td>27</td>\n",
       "      <td>29</td>\n",
       "      <td>29</td>\n",
       "      <td>29</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>NJ</th>\n",
       "      <td>261</td>\n",
       "      <td>261</td>\n",
       "      <td>261</td>\n",
       "      <td>261</td>\n",
       "      <td>261</td>\n",
       "      <td>261</td>\n",
       "      <td>261</td>\n",
       "      <td>250</td>\n",
       "      <td>261</td>\n",
       "      <td>261</td>\n",
       "      <td>261</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>NM</th>\n",
       "      <td>76</td>\n",
       "      <td>76</td>\n",
       "      <td>76</td>\n",
       "      <td>76</td>\n",
       "      <td>76</td>\n",
       "      <td>76</td>\n",
       "      <td>76</td>\n",
       "      <td>75</td>\n",
       "      <td>76</td>\n",
       "      <td>76</td>\n",
       "      <td>76</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>NV</th>\n",
       "      <td>253</td>\n",
       "      <td>253</td>\n",
       "      <td>253</td>\n",
       "      <td>253</td>\n",
       "      <td>253</td>\n",
       "      <td>253</td>\n",
       "      <td>253</td>\n",
       "      <td>230</td>\n",
       "      <td>253</td>\n",
       "      <td>253</td>\n",
       "      <td>253</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>NY</th>\n",
       "      <td>645</td>\n",
       "      <td>645</td>\n",
       "      <td>645</td>\n",
       "      <td>645</td>\n",
       "      <td>645</td>\n",
       "      <td>645</td>\n",
       "      <td>645</td>\n",
       "      <td>627</td>\n",
       "      <td>645</td>\n",
       "      <td>645</td>\n",
       "      <td>645</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>OH</th>\n",
       "      <td>378</td>\n",
       "      <td>378</td>\n",
       "      <td>378</td>\n",
       "      <td>378</td>\n",
       "      <td>378</td>\n",
       "      <td>378</td>\n",
       "      <td>377</td>\n",
       "      <td>357</td>\n",
       "      <td>378</td>\n",
       "      <td>378</td>\n",
       "      <td>378</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>OK</th>\n",
       "      <td>79</td>\n",
       "      <td>79</td>\n",
       "      <td>79</td>\n",
       "      <td>79</td>\n",
       "      <td>79</td>\n",
       "      <td>79</td>\n",
       "      <td>79</td>\n",
       "      <td>76</td>\n",
       "      <td>79</td>\n",
       "      <td>79</td>\n",
       "      <td>79</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>OR</th>\n",
       "      <td>359</td>\n",
       "      <td>359</td>\n",
       "      <td>359</td>\n",
       "      <td>359</td>\n",
       "      <td>359</td>\n",
       "      <td>359</td>\n",
       "      <td>359</td>\n",
       "      <td>343</td>\n",
       "      <td>359</td>\n",
       "      <td>359</td>\n",
       "      <td>359</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>PA</th>\n",
       "      <td>357</td>\n",
       "      <td>357</td>\n",
       "      <td>357</td>\n",
       "      <td>357</td>\n",
       "      <td>357</td>\n",
       "      <td>357</td>\n",
       "      <td>357</td>\n",
       "      <td>350</td>\n",
       "      <td>357</td>\n",
       "      <td>357</td>\n",
       "      <td>357</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>RI</th>\n",
       "      <td>27</td>\n",
       "      <td>27</td>\n",
       "      <td>27</td>\n",
       "      <td>27</td>\n",
       "      <td>27</td>\n",
       "      <td>27</td>\n",
       "      <td>27</td>\n",
       "      <td>27</td>\n",
       "      <td>27</td>\n",
       "      <td>27</td>\n",
       "      <td>27</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>SC</th>\n",
       "      <td>131</td>\n",
       "      <td>131</td>\n",
       "      <td>131</td>\n",
       "      <td>131</td>\n",
       "      <td>131</td>\n",
       "      <td>131</td>\n",
       "      <td>131</td>\n",
       "      <td>125</td>\n",
       "      <td>131</td>\n",
       "      <td>131</td>\n",
       "      <td>131</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>SD</th>\n",
       "      <td>25</td>\n",
       "      <td>25</td>\n",
       "      <td>25</td>\n",
       "      <td>25</td>\n",
       "      <td>25</td>\n",
       "      <td>25</td>\n",
       "      <td>25</td>\n",
       "      <td>25</td>\n",
       "      <td>25</td>\n",
       "      <td>25</td>\n",
       "      <td>25</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>TN</th>\n",
       "      <td>180</td>\n",
       "      <td>180</td>\n",
       "      <td>180</td>\n",
       "      <td>180</td>\n",
       "      <td>180</td>\n",
       "      <td>180</td>\n",
       "      <td>180</td>\n",
       "      <td>162</td>\n",
       "      <td>180</td>\n",
       "      <td>180</td>\n",
       "      <td>180</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>TX</th>\n",
       "      <td>1042</td>\n",
       "      <td>1042</td>\n",
       "      <td>1042</td>\n",
       "      <td>1042</td>\n",
       "      <td>1042</td>\n",
       "      <td>1042</td>\n",
       "      <td>1042</td>\n",
       "      <td>1002</td>\n",
       "      <td>1042</td>\n",
       "      <td>1042</td>\n",
       "      <td>1042</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>UT</th>\n",
       "      <td>101</td>\n",
       "      <td>101</td>\n",
       "      <td>101</td>\n",
       "      <td>101</td>\n",
       "      <td>101</td>\n",
       "      <td>101</td>\n",
       "      <td>101</td>\n",
       "      <td>99</td>\n",
       "      <td>101</td>\n",
       "      <td>101</td>\n",
       "      <td>101</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>VA</th>\n",
       "      <td>432</td>\n",
       "      <td>432</td>\n",
       "      <td>432</td>\n",
       "      <td>432</td>\n",
       "      <td>432</td>\n",
       "      <td>432</td>\n",
       "      <td>432</td>\n",
       "      <td>413</td>\n",
       "      <td>432</td>\n",
       "      <td>432</td>\n",
       "      <td>432</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>VT</th>\n",
       "      <td>8</td>\n",
       "      <td>8</td>\n",
       "      <td>8</td>\n",
       "      <td>8</td>\n",
       "      <td>8</td>\n",
       "      <td>8</td>\n",
       "      <td>8</td>\n",
       "      <td>8</td>\n",
       "      <td>8</td>\n",
       "      <td>8</td>\n",
       "      <td>8</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>WA</th>\n",
       "      <td>757</td>\n",
       "      <td>757</td>\n",
       "      <td>757</td>\n",
       "      <td>757</td>\n",
       "      <td>757</td>\n",
       "      <td>757</td>\n",
       "      <td>757</td>\n",
       "      <td>738</td>\n",
       "      <td>757</td>\n",
       "      <td>757</td>\n",
       "      <td>757</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>WI</th>\n",
       "      <td>145</td>\n",
       "      <td>145</td>\n",
       "      <td>145</td>\n",
       "      <td>145</td>\n",
       "      <td>145</td>\n",
       "      <td>145</td>\n",
       "      <td>145</td>\n",
       "      <td>144</td>\n",
       "      <td>145</td>\n",
       "      <td>145</td>\n",
       "      <td>145</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>WV</th>\n",
       "      <td>25</td>\n",
       "      <td>25</td>\n",
       "      <td>25</td>\n",
       "      <td>25</td>\n",
       "      <td>25</td>\n",
       "      <td>25</td>\n",
       "      <td>25</td>\n",
       "      <td>23</td>\n",
       "      <td>25</td>\n",
       "      <td>25</td>\n",
       "      <td>25</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>WY</th>\n",
       "      <td>23</td>\n",
       "      <td>23</td>\n",
       "      <td>23</td>\n",
       "      <td>23</td>\n",
       "      <td>23</td>\n",
       "      <td>23</td>\n",
       "      <td>23</td>\n",
       "      <td>22</td>\n",
       "      <td>23</td>\n",
       "      <td>23</td>\n",
       "      <td>23</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th rowspan=\"2\" valign=\"top\">VN</th>\n",
       "      <th>HN</th>\n",
       "      <td>6</td>\n",
       "      <td>6</td>\n",
       "      <td>6</td>\n",
       "      <td>6</td>\n",
       "      <td>6</td>\n",
       "      <td>6</td>\n",
       "      <td>6</td>\n",
       "      <td>6</td>\n",
       "      <td>6</td>\n",
       "      <td>6</td>\n",
       "      <td>6</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>SG</th>\n",
       "      <td>19</td>\n",
       "      <td>19</td>\n",
       "      <td>19</td>\n",
       "      <td>19</td>\n",
       "      <td>19</td>\n",
       "      <td>19</td>\n",
       "      <td>19</td>\n",
       "      <td>17</td>\n",
       "      <td>19</td>\n",
       "      <td>19</td>\n",
       "      <td>19</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>ZA</th>\n",
       "      <th>GT</th>\n",
       "      <td>3</td>\n",
       "      <td>3</td>\n",
       "      <td>3</td>\n",
       "      <td>3</td>\n",
       "      <td>3</td>\n",
       "      <td>3</td>\n",
       "      <td>3</td>\n",
       "      <td>2</td>\n",
       "      <td>3</td>\n",
       "      <td>3</td>\n",
       "      <td>3</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>545 rows × 11 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "                        Brand  Store Number  Store Name  Ownership Type  \\\n",
       "Country State/Province                                                    \n",
       "AD      7                   1             1           1               1   \n",
       "AE      AJ                  2             2           2               2   \n",
       "        AZ                 48            48          48              48   \n",
       "        DU                 82            82          82              82   \n",
       "        FU                  2             2           2               2   \n",
       "        RK                  3             3           3               3   \n",
       "        SH                  6             6           6               6   \n",
       "        UQ                  1             1           1               1   \n",
       "AR      B                  21            21          21              21   \n",
       "        C                  73            73          73              73   \n",
       "        M                   5             5           5               5   \n",
       "        S                   3             3           3               3   \n",
       "        X                   6             6           6               6   \n",
       "AT      3                   1             1           1               1   \n",
       "        5                   3             3           3               3   \n",
       "        9                  14            14          14              14   \n",
       "AU      NSW                 9             9           9               9   \n",
       "        QLD                 8             8           8               8   \n",
       "        VIC                 5             5           5               5   \n",
       "AW      AW                  3             3           3               3   \n",
       "AZ      BA                  3             3           3               3   \n",
       "        SAB                 1             1           1               1   \n",
       "BE      BE                  4             4           4               4   \n",
       "        VAN                 1             1           1               1   \n",
       "        VBR                 2             2           2               2   \n",
       "        VLG                10            10          10              10   \n",
       "        WAL                 2             2           2               2   \n",
       "BG      2                   1             1           1               1   \n",
       "        23                  4             4           4               4   \n",
       "BH      13                 16            16          16              16   \n",
       "...                       ...           ...         ...             ...   \n",
       "US      MO                188           188         188             188   \n",
       "        MS                 32            32          32              32   \n",
       "        MT                 36            36          36              36   \n",
       "        NC                338           338         338             338   \n",
       "        ND                 13            13          13              13   \n",
       "        NE                 58            58          58              58   \n",
       "        NH                 29            29          29              29   \n",
       "        NJ                261           261         261             261   \n",
       "        NM                 76            76          76              76   \n",
       "        NV                253           253         253             253   \n",
       "        NY                645           645         645             645   \n",
       "        OH                378           378         378             378   \n",
       "        OK                 79            79          79              79   \n",
       "        OR                359           359         359             359   \n",
       "        PA                357           357         357             357   \n",
       "        RI                 27            27          27              27   \n",
       "        SC                131           131         131             131   \n",
       "        SD                 25            25          25              25   \n",
       "        TN                180           180         180             180   \n",
       "        TX               1042          1042        1042            1042   \n",
       "        UT                101           101         101             101   \n",
       "        VA                432           432         432             432   \n",
       "        VT                  8             8           8               8   \n",
       "        WA                757           757         757             757   \n",
       "        WI                145           145         145             145   \n",
       "        WV                 25            25          25              25   \n",
       "        WY                 23            23          23              23   \n",
       "VN      HN                  6             6           6               6   \n",
       "        SG                 19            19          19              19   \n",
       "ZA      GT                  3             3           3               3   \n",
       "\n",
       "                        Street Address  City  Postcode  Phone Number  \\\n",
       "Country State/Province                                                 \n",
       "AD      7                            1     1         1             1   \n",
       "AE      AJ                           2     2         0             0   \n",
       "        AZ                          48    48         7            20   \n",
       "        DU                          82    82        16            50   \n",
       "        FU                           2     2         1             0   \n",
       "        RK                           3     3         0             3   \n",
       "        SH                           6     6         0             5   \n",
       "        UQ                           1     1         0             0   \n",
       "AR      B                           21    21        18             5   \n",
       "        C                           73    73        71            24   \n",
       "        M                            5     5         2             0   \n",
       "        S                            3     3         3             0   \n",
       "        X                            6     6         6             0   \n",
       "AT      3                            1     1         1             1   \n",
       "        5                            3     3         3             3   \n",
       "        9                           14    14        14            13   \n",
       "AU      NSW                          9     9         9             0   \n",
       "        QLD                          8     8         8             0   \n",
       "        VIC                          5     5         5             0   \n",
       "AW      AW                           3     3         0             3   \n",
       "AZ      BA                           3     3         2             3   \n",
       "        SAB                          1     1         1             1   \n",
       "BE      BE                           4     4         4             0   \n",
       "        VAN                          1     1         1             0   \n",
       "        VBR                          2     2         2             0   \n",
       "        VLG                         10    10        10             1   \n",
       "        WAL                          2     2         2             0   \n",
       "BG      2                            1     1         0             0   \n",
       "        23                           4     4         1             0   \n",
       "BH      13                          16    16         2            10   \n",
       "...                                ...   ...       ...           ...   \n",
       "US      MO                         188   188       188           175   \n",
       "        MS                          32    32        32            28   \n",
       "        MT                          36    36        36            36   \n",
       "        NC                         338   338       338           322   \n",
       "        ND                          13    13        13            13   \n",
       "        NE                          58    58        58            56   \n",
       "        NH                          29    29        29            27   \n",
       "        NJ                         261   261       261           250   \n",
       "        NM                          76    76        76            75   \n",
       "        NV                         253   253       253           230   \n",
       "        NY                         645   645       645           627   \n",
       "        OH                         378   378       377           357   \n",
       "        OK                          79    79        79            76   \n",
       "        OR                         359   359       359           343   \n",
       "        PA                         357   357       357           350   \n",
       "        RI                          27    27        27            27   \n",
       "        SC                         131   131       131           125   \n",
       "        SD                          25    25        25            25   \n",
       "        TN                         180   180       180           162   \n",
       "        TX                        1042  1042      1042          1002   \n",
       "        UT                         101   101       101            99   \n",
       "        VA                         432   432       432           413   \n",
       "        VT                           8     8         8             8   \n",
       "        WA                         757   757       757           738   \n",
       "        WI                         145   145       145           144   \n",
       "        WV                          25    25        25            23   \n",
       "        WY                          23    23        23            22   \n",
       "VN      HN                           6     6         6             6   \n",
       "        SG                          19    19        19            17   \n",
       "ZA      GT                           3     3         3             2   \n",
       "\n",
       "                        Timezone  Longitude  Latitude  \n",
       "Country State/Province                                 \n",
       "AD      7                      1          1         1  \n",
       "AE      AJ                     2          2         2  \n",
       "        AZ                    48         48        48  \n",
       "        DU                    82         82        82  \n",
       "        FU                     2          2         2  \n",
       "        RK                     3          3         3  \n",
       "        SH                     6          6         6  \n",
       "        UQ                     1          1         1  \n",
       "AR      B                     21         21        21  \n",
       "        C                     73         73        73  \n",
       "        M                      5          5         5  \n",
       "        S                      3          3         3  \n",
       "        X                      6          6         6  \n",
       "AT      3                      1          1         1  \n",
       "        5                      3          3         3  \n",
       "        9                     14         14        14  \n",
       "AU      NSW                    9          9         9  \n",
       "        QLD                    8          8         8  \n",
       "        VIC                    5          5         5  \n",
       "AW      AW                     3          3         3  \n",
       "AZ      BA                     3          3         3  \n",
       "        SAB                    1          1         1  \n",
       "BE      BE                     4          4         4  \n",
       "        VAN                    1          1         1  \n",
       "        VBR                    2          2         2  \n",
       "        VLG                   10         10        10  \n",
       "        WAL                    2          2         2  \n",
       "BG      2                      1          1         1  \n",
       "        23                     4          4         4  \n",
       "BH      13                    16         16        16  \n",
       "...                          ...        ...       ...  \n",
       "US      MO                   188        188       188  \n",
       "        MS                    32         32        32  \n",
       "        MT                    36         36        36  \n",
       "        NC                   338        338       338  \n",
       "        ND                    13         13        13  \n",
       "        NE                    58         58        58  \n",
       "        NH                    29         29        29  \n",
       "        NJ                   261        261       261  \n",
       "        NM                    76         76        76  \n",
       "        NV                   253        253       253  \n",
       "        NY                   645        645       645  \n",
       "        OH                   378        378       378  \n",
       "        OK                    79         79        79  \n",
       "        OR                   359        359       359  \n",
       "        PA                   357        357       357  \n",
       "        RI                    27         27        27  \n",
       "        SC                   131        131       131  \n",
       "        SD                    25         25        25  \n",
       "        TN                   180        180       180  \n",
       "        TX                  1042       1042      1042  \n",
       "        UT                   101        101       101  \n",
       "        VA                   432        432       432  \n",
       "        VT                     8          8         8  \n",
       "        WA                   757        757       757  \n",
       "        WI                   145        145       145  \n",
       "        WV                    25         25        25  \n",
       "        WY                    23         23        23  \n",
       "VN      HN                     6          6         6  \n",
       "        SG                    19         19        19  \n",
       "ZA      GT                     3          3         3  \n",
       "\n",
       "[545 rows x 11 columns]"
      ]
     },
     "execution_count": 60,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "starbucks.groupby([\"Country\", \"State/Province\"]).count()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.6.5"
  },
  "toc": {
   "base_numbering": 1,
   "nav_menu": {},
   "number_sections": true,
   "sideBar": true,
   "skip_h1_title": false,
   "title_cell": "Table of Contents",
   "title_sidebar": "Contents",
   "toc_cell": false,
   "toc_position": {
    "height": "calc(100% - 180px)",
    "left": "10px",
    "top": "150px",
    "width": "165px"
   },
   "toc_section_display": true,
   "toc_window_display": true
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
